andersao / andersao/l5-repository

Limit result whitout paginate

オープン
#426 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
PHP
スター
4.2k
フォーク
880
PR マージ指標
30日以内にマージされた PR はありません

説明

Hello, Good Night,

How can I limit the result, lets say to the first 5 items without paginate...

example

a blog has it's posts, the main page have the posts paginated, but a sidebar has the last 5 items...
How can i get the sidebar items, if I use paginate it will get the results with pagination, i don't want to get all items and do a for...

I've tried
$this->repository->orderBy('created_at','DESC')->get(10);
$this->repository->orderBy('created_at','DESC')->first(10);
$this->repository->orderBy('created_at','DESC')->limit(10);

$this->repository->orderBy('created_at','DESC')->paginate(10); (This one returned with paginated items

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。