scriptotek /
bibrex
| 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
Loading history...
|
|||
| 21 | 'created_at' => $this->created_at->toDateTimeString(), |
||
|
0 ignored issues
–
show
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
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
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
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 |