diff --git a/app/controllers/DashboardController.php b/app/controllers/DashboardController.php index 14aca739..5733f1fe 100644 --- a/app/controllers/DashboardController.php +++ b/app/controllers/DashboardController.php @@ -9,6 +9,10 @@ class DashboardController extends Controller { return View::make('dashboard.index'); } + /** + * Creates a new incident. + * @return \Illuminate\Http\RedirectResponse + */ public function createIncidentAction() { $_incident = Input::get('incident'); $incident = Incident::create($_incident); @@ -29,6 +33,10 @@ class DashboardController extends Controller { ]); } + /** + * Creates a new component. + * @return \Illuminate\Http\RedirectResponse + */ public function createComponentAction() { $_component = Input::get('component'); $component = Component::create($_component); @@ -36,6 +44,16 @@ class DashboardController extends Controller { return Redirect::back()->with('component', $component); } + /** + * Deletes a given component. + * @param Component $component + * @return \Illuminate\Http\RedirectResponse + */ + public function deleteComponentAction(Component $component) { + $component->delete(); + return Redirect::back(); + } + /** * Shows the incidents view. * @return \Illuminate\View\View diff --git a/app/routes/dashboard.php b/app/routes/dashboard.php index 43ce9a09..b8d32e90 100644 --- a/app/routes/dashboard.php +++ b/app/routes/dashboard.php @@ -6,6 +6,7 @@ Route::group(['before' => 'auth', 'prefix' => 'dashboard'], function() { Route::get('components', ['as' => 'dashboard.components', 'uses' => 'DashboardController@showComponents']); Route::post('components/create', 'DashboardController@createComponentAction'); + Route::get('components/{component}/delete', 'DashboardController@deleteComponentAction'); Route::get('incidents', ['as' => 'dashboard.incidents', 'uses' => 'DashboardController@showIncidents']); Route::get('metrics', ['as' => 'dashboard.metrics', 'uses' => 'DashboardController@showMetrics']); diff --git a/app/views/dashboard/components.blade.php b/app/views/dashboard/components.blade.php index 878bdad9..c3ca5a2e 100644 --- a/app/views/dashboard/components.blade.php +++ b/app/views/dashboard/components.blade.php @@ -17,7 +17,7 @@