diff --git a/app/controllers/DashboardController.php b/app/controllers/DashboardController.php index eac65281..976351a0 100644 --- a/app/controllers/DashboardController.php +++ b/app/controllers/DashboardController.php @@ -9,6 +9,15 @@ class DashboardController extends Controller { return View::make('dashboard.index'); } + public function createIncidentAction() { + $_incident = Input::get('incident'); + $_incident['user_id'] = Auth::user()->id; + + $incident = Incident::create($_incident); + + return Redirect::back()->with('incident', $incident); + } + /** * Shows the components view. * @return \Illuminate\View\View diff --git a/app/database/migrations/2014_12_13_121410_AlterTableIncidentsRemoveDefaultComponent.php b/app/database/migrations/2014_12_13_121410_AlterTableIncidentsRemoveDefaultComponent.php new file mode 100644 index 00000000..91d5ad5d --- /dev/null +++ b/app/database/migrations/2014_12_13_121410_AlterTableIncidentsRemoveDefaultComponent.php @@ -0,0 +1,34 @@ + 'required|integer', - 'component_id' => 'required|integer', + 'component_id' => 'integer', 'name' => 'required', 'status' => 'required|integer', 'message' => 'required', ]; - protected $fillable = ['component_id', 'name', 'status', 'message']; + protected $fillable = ['user_id', 'component_id', 'name', 'status', 'message']; protected $appends = ['humanStatus']; diff --git a/app/routes/dashboard.php b/app/routes/dashboard.php index f90b8eb3..93bc6995 100644 --- a/app/routes/dashboard.php +++ b/app/routes/dashboard.php @@ -2,6 +2,8 @@ Route::group(['before' => 'auth', 'prefix' => 'dashboard'], function() { Route::get('/', ['as' => 'dashboard', 'uses' => 'DashboardController@showDashboard']); + Route::post('/', 'DashboardController@createIncidentAction'); + Route::get('components', ['as' => 'dashboard.components', 'uses' => 'DashboardController@showComponents']); Route::get('incidents', ['as' => 'dashboard.incidents', 'uses' => 'DashboardController@showIncidents']); Route::get('metrics', ['as' => 'dashboard.metrics', 'uses' => 'DashboardController@showMetrics']); diff --git a/app/views/dashboard/index.blade.php b/app/views/dashboard/index.blade.php index 60fe887c..5b2a62fc 100644 --- a/app/views/dashboard/index.blade.php +++ b/app/views/dashboard/index.blade.php @@ -9,14 +9,59 @@