Issues (158)

app/Http/Resources/ThingResource.php (5 issues)

1
<?php
2
3
namespace App\Http\Resources;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
6
7
class ThingResource extends JsonResource
8
{
9
    /**
10
     * Transform the resource into an array.
11
     *
12
     * @param  \Illuminate\Http\Request  $request
13
     * @return array
14
     */
15
    public function toArray($request)
16
    {
17
        return array_merge(
18
            [
19
                'type' => 'thing',
20
                'id' => $this->id,
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on App\Http\Resources\ThingResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
21
                'created_at' => $this->created_at->toDateTimeString(),
0 ignored issues
show
Bug Best Practice introduced by
The property created_at does not exist on App\Http\Resources\ThingResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
22
                'updated_at' => $this->updated_at->toDateTimeString(),
0 ignored issues
show
Bug Best Practice introduced by
The property updated_at does not exist on App\Http\Resources\ThingResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
23
                'items' => ItemResource::collection($this->whenLoaded('items')),
24
                'image' => $this->image,
0 ignored issues
show
Bug Best Practice introduced by
The property image does not exist on App\Http\Resources\ThingResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
25
            ],
26
            $this->properties->toArray()
0 ignored issues
show
Bug Best Practice introduced by
The property properties does not exist on App\Http\Resources\ThingResource. Since you implemented __get, consider adding a @property annotation.
Loading history...
27
        );
28
    }
29
}
30