Skip to content
This repository has been archived by the owner on Jan 15, 2020. It is now read-only.

Commit

Permalink
Add service api method
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Feb 24, 2019
1 parent 4bb63e5 commit eb3a796
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app/Http/Controllers/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ public function services(Request $request)
return $this->fractal->createData($res)->toArray();
}


public function service(Request $request, $id)
{
$service = Service::findOrFail($id);
$res = new Fractal\Resource\Item($service, new ServiceTransformer());
return $this->fractal->createData($res)->toArray();
}

public function incidents(Request $request)
{
$incidents = collect([]);
Expand Down
3 changes: 2 additions & 1 deletion routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@


Route::group(['prefix' => 'api/v1'], function() {
Route::get('services', 'ApiController@services');
Route::get('systems', 'ApiController@systems');
Route::get('services', 'ApiController@services');
Route::get('service/{id}', 'ApiController@service');
Route::get('incidents', 'ApiController@incidents');
});

Expand Down

0 comments on commit eb3a796

Please sign in to comment.