You can now get metrics

This commit is contained in:
James Brooks
2014-11-25 20:31:07 +00:00
parent f60f861b1c
commit 49f42b57c9
2 changed files with 26 additions and 0 deletions

View File

@@ -106,6 +106,30 @@
return $this->saveIncident($incident);
}
/**
* Get all metrics
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getMetrics() {
return Metric::all();
}
/**
* Get a single metric
*
* @param int $id
*
* @return Metric
*/
public function getMetric($id) {
if ($metric = Metric::find($id)) {
return $metric;
} else {
App::abort(404, 'Metric not found');
}
}
/**
* Function for saving the incident, and returning appropriate error codes
*

View File

@@ -7,6 +7,8 @@
Route::get('components/{id}/incidents', 'ApiController@getComponentIncidents');
Route::get('incidents', 'ApiController@getIncidents');
Route::get('incidents/{id}', 'ApiController@getIncident');
Route::get('metrics', 'ApiController@getMetrics');
Route::get('metrics/{id}', 'ApiController@getMetric');
Route::group(['protected' => true], function() {
Route::post('components', 'ApiController@postComponents');