Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Resource Support #1515

Closed
cairocoder opened this issue Nov 20, 2017 · 3 comments
Closed

API Resource Support #1515

cairocoder opened this issue Nov 20, 2017 · 3 comments

Comments

@cairocoder
Copy link

cairocoder commented Nov 20, 2017

Summary of problem or feature request

Is current version supports Eloquent API Resource?
As I am getting an Error:

Code snippet of problem

$items = ItemList::collection(Item::get());
return DataTables::of($items)->make(true);

No available engine for Illuminate\\Http\\Resources\\Json\\AnonymousResourceCollection

System details

  • Operating System: CentOs
  • PHP Version: 7
  • Laravel Version: 5.5
  • Laravel-Datatables Version: MySQL 5.7
@yajra
Copy link
Owner

yajra commented Nov 21, 2017

It's not yet supported but you can convert it to collection instead for a workaround.

$items = ItemList::collection(Item::get())->collection->pluck('resource');
return DataTables::of($items)->make(true);

@cairocoder
Copy link
Author

Thanks for your reply.

But this will return the collection of Items model, not the Resource API model.
Can I work around to return the API Resource structure instead?

@yajra
Copy link
Owner

yajra commented May 10, 2018

Fixed on #1702

@yajra yajra closed this as completed May 10, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants