skip to Main Content

Laravel – Why larastan raise error on relationLoaded method in resource file?

In resource file app/Http/Resources/PostResource.php I use method : <?php namespace AppHttpResources; use IlluminateHttpResourcesJsonJsonResource; class PostResource extends JsonResource { public function toArray($request) { $data = [ 'id' => $this->id, ... 'mediaProp'=> $this->when($this->relationLoaded('mediaProp'), new MediaPropResource($this->mediaProp)), ]; But I got error when running…

VIEW QUESTION

Laravel resource performance

I'm using laravel framework and now I'm thinking that if laravel resource reduce the performance? Because it at first select all columns (select * from TABLE) then put the result in loop of resource. So does this loop slow down…

VIEW QUESTION
Back To Top
Search