You can now get metrics
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user