mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-17 21:49:01 +01:00
API for returning incidents on a component, including incident_count
This commit is contained in:
parent
3ba9db5d24
commit
f9ceb70e50
@ -14,4 +14,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
public function getComponentIncidents($id) {
|
||||
$component = $this->getComponent($id);
|
||||
return $component->incidents;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,5 +4,6 @@
|
||||
|
||||
Route::get('components', 'ApiController@getComponents');
|
||||
Route::get('components/{id}', 'ApiController@getComponent');
|
||||
Route::get('components/{id}/incidents', 'ApiController@getComponentIncidents');
|
||||
|
||||
});
|
||||
|
@ -8,6 +8,7 @@
|
||||
'description' => $component->description,
|
||||
'status_id' => (int) $component->status,
|
||||
'status' => $component->getHumanStatusAttribute(),
|
||||
'incident_count' => $component->incidents()->count()
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user