Hey,
specifying the controller like this should be fine:
Route::get('/clients', function () {
$clients = B3Clients::with('group')->paginate();
return ClientResource::collection($clients);
});
Also, how does your model B3Clients look like? Do you have any hidden fields defined in there? Also the GroupResource and the group model?
The error message itself says that there's a query builder instance passed to the collection or some other class where it shouldn't. Resources expect an array or a collection (or likewise) object.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community