Support the ongoing development of →
API Laravel
Last updated 1 year ago.
moderator Solution

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:

pennywise96 liked this reply

Solution selected by @pennywise96

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.