简体   繁体   中英

Limit and offset in laravel scout

我正在为我的 api 使用 scout,所以不能使用 pagination ,因为 scout 只提供分页,所以有什么方法可以在 laravel scout 中使用 offset 和 limit 吗?

U can use method take()

$result = YourModel::search('query')->take(20)->raw()

or

$result = YourModel::search('query')->take(20)->get()

Pagination is built into scout...

https://laravel.com/docs/5.5/scout#pagination

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM