Code Coverage  | 
      ||||||||||
Lines  | 
       Functions and Methods  | 
       Classes and Traits  | 
      ||||||||
| Total |         | 
       100.00%  | 
       6 / 6  | 
               | 
       100.00%  | 
       1 / 1  | 
       CRAP |         | 
       100.00%  | 
       1 / 1  | 
      
| LocationResource |         | 
       100.00%  | 
       6 / 6  | 
               | 
       100.00%  | 
       1 / 1  | 
       2 |         | 
       100.00%  | 
       1 / 1  | 
      
| toArray |         | 
       100.00%  | 
       6 / 6  | 
               | 
       100.00%  | 
       1 / 1  | 
       2 | |||
| 1 | <?php | 
| 2 | |
| 3 | declare(strict_types=1); | 
| 4 | |
| 5 | namespace Engelsystem\Controllers\Api\Resources; | 
| 6 | |
| 7 | use Engelsystem\Models\BaseModel; | 
| 8 | use Engelsystem\Models\Location; | 
| 9 | use Illuminate\Database\Eloquent\Relations\Pivot; | 
| 10 | use Illuminate\Support\Collection; | 
| 11 | |
| 12 | class LocationResource extends BasicResource | 
| 13 | { | 
| 14 | protected Collection | BaseModel | Pivot | Location $model; | 
| 15 | |
| 16 | public function toArray(): array | 
| 17 | { | 
| 18 | return [ | 
| 19 | 'id' => $this->model->id, | 
| 20 | 'name' => $this->model->name, | 
| 21 | 'description' => $this->model->description ?: '', | 
| 22 | 'url' => url('/locations', ['action' => 'view', 'location_id' => $this->model->id]), | 
| 23 | ]; | 
| 24 | } | 
| 25 | } |