feat: add foundation to support emotions and ability to log emotions during a phone call (#2144)

This commit is contained in:
Régis Freyd
2018-12-13 15:01:47 -05:00
committed by GitHub
parent e9375dfe8f
commit a4e051e61c
38 changed files with 1338 additions and 23 deletions
@@ -40,6 +40,7 @@ class CallsController extends Controller
'content' => $request->get('content'),
'called_at' => $request->get('called_at'),
'contact_called' => $request->get('contact_called'),
'emotions' => $request->get('emotions'),
]);
}
@@ -58,6 +59,7 @@ class CallsController extends Controller
'content' => $request->get('content'),
'called_at' => $request->get('called_at'),
'contact_called' => $request->get('contact_called'),
'emotions' => $request->get('emotions'),
]);
}
@@ -0,0 +1,48 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Instance\Emotion\Emotion;
use App\Models\Instance\Emotion\PrimaryEmotion;
use App\Models\Instance\Emotion\SecondaryEmotion;
use App\Http\Resources\Emotion\Emotion as EmotionResource;
class EmotionController extends Controller
{
/**
* Get the list of primary emotions.
*
* @return \Illuminate\Http\Response
*/
public function primaries()
{
return EmotionResource::collection(PrimaryEmotion::get());
}
/**
* Get the list of secondary emotions.
*
* @return \Illuminate\Http\Response
*/
public function secondaries(Request $request, $primaryEmotionId)
{
$secondaries = SecondaryEmotion::where('emotion_primary_id', $primaryEmotionId)
->get();
return EmotionResource::collection($secondaries);
}
/**
* Get the list of emotions.
*
* @return \Illuminate\Http\Response
*/
public function emotions(Request $request, $primaryEmotionId, $secondaryEmotionId)
{
$emotions = Emotion::where('emotion_secondary_id', $secondaryEmotionId)
->get();
return EmotionResource::collection($emotions);
}
}
@@ -45,6 +45,9 @@ class SettingsController
'default_life_event_types',
'default_relationship_type_groups',
'default_relationship_types',
'emotions',
'emotions_primary',
'emotions_secondary',
'failed_jobs',
'instances',
'jobs',