Added UpdateIncidentCommand
This commit is contained in:
@@ -13,6 +13,7 @@ namespace CachetHQ\Cachet\Http\Controllers\Api;
|
||||
|
||||
use CachetHQ\Cachet\Commands\Incident\RemoveIncidentCommand;
|
||||
use CachetHQ\Cachet\Commands\Incident\ReportIncidentCommand;
|
||||
use CachetHQ\Cachet\Commands\Incident\UpdateIncidentCommand;
|
||||
use CachetHQ\Cachet\Models\Incident;
|
||||
use Exception;
|
||||
use GrahamCampbell\Binput\Facades\Binput;
|
||||
@@ -89,17 +90,17 @@ class IncidentController extends AbstractApiController
|
||||
*/
|
||||
public function putIncident(Incident $incident)
|
||||
{
|
||||
$incidentData = array_filter(Binput::only([
|
||||
'name',
|
||||
'message',
|
||||
'status',
|
||||
'component_id',
|
||||
'notify',
|
||||
'visible',
|
||||
]));
|
||||
|
||||
try {
|
||||
$incident->update($incidentData);
|
||||
$incident = $this->dispatch(new UpdateIncidentCommand(
|
||||
$incident,
|
||||
Binput::get('name'),
|
||||
Binput::get('status'),
|
||||
Binput::get('message'),
|
||||
Binput::get('visible', true),
|
||||
Binput::get('component_id'),
|
||||
Binput::get('component_status'),
|
||||
Binput::get('notify', true)
|
||||
));
|
||||
} catch (Exception $e) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user