Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
NewsResource
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 toArray
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Engelsystem\Controllers\Api\Resources;
6
7use Engelsystem\Models\BaseModel;
8use Engelsystem\Models\News;
9use Illuminate\Support\Collection;
10
11class NewsResource extends BasicResource
12{
13    protected Collection | BaseModel | News $model;
14
15    public function toArray(): array
16    {
17        return [
18            'id' => $this->model->id,
19            'name' => $this->model->title,
20            'text' => $this->model->text,
21            'is_meeting' => $this->model->is_meeting,
22            'is_pinned' => $this->model->is_pinned,
23            'is_highlighted' => $this->model->is_highlighted,
24            'created_at' => $this->model->created_at,
25            'updated_at' => $this->model->updated_at,
26            'url' => url('/news/' . $this->model->id),
27        ];
28    }
29}