Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Laravel API ResourceCollection doesnt works

use AppHttpResourcesProductCollection;
use AppHttpResourcesProductResource;
// for single collection resource in   
return new ProductCollection(Product::all()); //or
return ProductResource::collection(Product::all());
//for single resource
return new ProductResource(Product::findOrFail($id));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Laravel #API #ResourceCollection #doesnt #works
ADD COMMENT
Topic
Name
7+7 =