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