| Total Complexity | 3 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 15 | class ListPostResource extends BaseListPostResource |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @param Request $request |
||
| 19 | * |
||
| 20 | * @return array<string, mixed> |
||
| 21 | */ |
||
| 22 | public function toArray($request): array |
||
| 23 | { |
||
| 24 | /** @var Post $this */ |
||
| 25 | |||
| 26 | return [ |
||
| 27 | 'id' => $this->id, |
||
| 28 | 'name' => $this->name, |
||
| 29 | 'slug' => $this->slug, |
||
| 30 | 'description' => $this->description, |
||
| 31 | 'image' => $this->image ? RvMedia::url($this->image) : null, |
||
| 32 | 'categories' => CategoryResource::collection($this->categories), |
||
| 33 | 'tags' => TagResource::collection($this->tags), |
||
| 34 | 'author' => AuthorResource::make($this->author), |
||
| 35 | 'created_at' => $this->created_at, |
||
| 36 | 'updated_at' => $this->updated_at, |
||
| 37 | ]; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param mixed $resource |
||
| 42 | * |
||
| 43 | * @return AnonymousResourceCollection |
||
| 44 | */ |
||
| 45 | public static function collection(mixed $resource): AnonymousResourceCollection |
||
| 48 | } |
||
| 49 | } |
||
| 50 |