How to query the first 50 data in laravel's Eloquent ORM
阿神
阿神 2017-05-16 16:56:07
0
1
555
$product = Product::all();

This is to investigate and deal with all products

I want to output 50 pieces of data on the html page first;

When the user pulls down, go to ajax to query the subsequent data

html page data, how to query the first 50 data

And there are conditions. The product must be on the shelves

阿神
阿神

闭关修行中......

reply all(1)
PHPzhong

Paging$product = Product::paginate(50);passed to blade through view
Pass variables $pos, $limit when pulling down to refresh $product = Product::where([])->skip($pos)->take($limit)->get();

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template