Deleting of incidents

This commit is contained in:
James Brooks
2014-12-22 12:55:26 +00:00
parent 9e2da638f8
commit 37487ad653
3 changed files with 34 additions and 1 deletions
+13 -1
View File
@@ -8,7 +8,7 @@ class DashIncidentController extends Controller
*/
public function showIncidents()
{
$incidents = Incident::all();
$incidents = Incident::orderBy('created_at', 'desc')->get();
return View::make('dashboard.incidents')->with([
'pageTitle' => 'Incidents - Dashboard',
@@ -61,4 +61,16 @@ class DashIncidentController extends Controller
return Redirect::back()->with('incident', $incident);
}
/**
* Deletes a given incident.
* @param Incident $incident
* @return \Illuminate\Http\RedirectResponse
*/
public function deleteIncidentAction(Incident $incident)
{
$incident->delete();
return Redirect::back();
}
}