You cannot resolve a resource from the container. It needs to be instantiated with an Eloquent model as a dependency. You need to use it with a collection like this:
$result = $this->model->all();
return Resource::collection($result);
Please read the docs carefully: https://laravel.com/docs/9.x/eloquent-resources
pennywise96 liked this reply
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community