如何在使用树枝的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