Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
LocationsController | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
index | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Engelsystem\Controllers\Api; |
6 | |
7 | use Engelsystem\Controllers\Api\Resources\LocationResource; |
8 | use Engelsystem\Http\Response; |
9 | use Engelsystem\Models\Location; |
10 | |
11 | class LocationsController extends ApiController |
12 | { |
13 | public function index(): Response |
14 | { |
15 | $models = Location::query() |
16 | ->orderBy('name') |
17 | ->get(); |
18 | |
19 | $data = ['data' => LocationResource::collection($models)]; |
20 | return $this->response |
21 | ->withContent(json_encode($data)); |
22 | } |
23 | } |