如何在使用樹枝的Slim 3項目中使用Eloquent中的Paginate功能?Slim 3項目中使用樹枝的雄辯分頁功能
這是在我的控制器:
$posts = Sound::paginate(2);
$this->container->view->render($response, 'admin/sounds/index.twig', [
'posts' => $posts
]);
這是視圖:
{{ posts.links() }}
但正如我預期它不工作,以及:
Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in **PATH_TO_PROJECT**\vendor\illuminate\pagination\AbstractPaginator.php on line 412
Fatal error: Call to a member function make() on null in **PATH_TO_PROJECT**\vendor\illuminate\pagination\LengthAwarePaginator.php on line 90
我必須做些什麼來使其工作?
雖然這可能會在理論上回答這個問題,但[這將是更可取的](// meta.stackoverflow.com/q/8259)在這裏包含答案的基本部分,並提供供參考的鏈接。 – GhostCat