Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ShiftTypeController | |
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\ShiftTypeResource; |
| 8 | use Engelsystem\Http\Response; |
| 9 | use Engelsystem\Models\Shifts\ShiftType; |
| 10 | |
| 11 | class ShiftTypeController extends ApiController |
| 12 | { |
| 13 | use UsesAuth; |
| 14 | |
| 15 | public function index(): Response |
| 16 | { |
| 17 | $models = ShiftType::query() |
| 18 | ->orderBy('name') |
| 19 | ->get(); |
| 20 | |
| 21 | $data = ['data' => ShiftTypeResource::collection($models)]; |
| 22 | return $this->response |
| 23 | ->withContent(json_encode($data)); |
| 24 | } |
| 25 | } |