Incidents will now be removed via the command

This commit is contained in:
James Brooks
2015-08-26 13:21:23 +01:00
parent b80b53191b
commit 7be3aa2552
2 changed files with 10 additions and 2 deletions

View File

@@ -11,16 +11,20 @@
namespace CachetHQ\Cachet\Http\Controllers\Api;
use CachetHQ\Cachet\Commands\Incident\RemoveIncidentCommand;
use CachetHQ\Cachet\Events\Incident\IncidentWasReportedEvent;
use CachetHQ\Cachet\Models\Incident;
use Exception;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
class IncidentController extends AbstractApiController
{
use DispatchesJobs;
/**
* Get all incidents.
*
@@ -122,7 +126,7 @@ class IncidentController extends AbstractApiController
*/
public function deleteIncident(Incident $incident)
{
$incident->delete();
$this->dispatch(new RemoveIncidentCommand($incident));
return $this->noContent();
}