Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

return json response id name from eloquent all laravel

 $products = Product::all('id','name');
or
 $products = Product::get(['id','name']);
or
 $products = Product::pluck('id','name');
or
 $products = Product::all()->pluck('name', 'id');
 
PREVIOUS NEXT
Tagged: #return #json #response #id #eloquent #laravel
ADD COMMENT
Topic
Name
9+5 =