我试图在laravel.Checking的laravel文档创建原始查询手动分页,我看到使用方法分页程序,如:`原始查询的手动分页laravel
$申请人=分页程序::使($申请人,$ totalApplicants,4);`
但是,当我返回$申请人它给我所有的记录,而不是我的Paginator :: make方法所要求的4,但如果我打电话给我的申请人的链接()mehod像:$ applicants-> links()它返回到我的视图的分页链接
请问我做错了什么,或者我需要写一个mehod使这项工作
从我的控制器代码:
$statement3 = "SELECT * FROM applicant where lga = '$appulga' ";
//loop through lga id to build query
foreach($LGA_Names as $lga)
{
$statement3.= " "."OR"." "."lga=". "'".$lga."'";
}
//FAcility for User assigned LGA
$applicants = DB::Select($statement3);
///////////////////////////////////////////////////////////////
$totalApplicants = count($applicants);
$perpage = 4;
$applicants = Paginator::make($applicants,$totalApplicants,$perpage);
你能分享更多的代码吗? '$ applicants'必须是数组 – knpsck 2014-11-08 13:32:05
只是从我的控制器 – 2014-11-08 13:38:03