Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ShiftTypeController
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 index
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Engelsystem\Controllers\Api;
6
7use Engelsystem\Controllers\Api\Resources\ShiftTypeResource;
8use Engelsystem\Http\Response;
9use Engelsystem\Models\Shifts\ShiftType;
10
11class 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}