我有来自2个不同表的联合查询,我必须通过原始查询运行。但是我在paginatig面临着一个问题。这就是我所做的
namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Pagination\Paginator;
use Illuminate\Http\Request;
class SiteController extends Controller {
public function index()
{
$result = \DB::select(\DB::raw("UNION query"));
$result_p = Paginator::make($result , count($result), 10);
return view('view_name',compact('result'));
}
}
这会产生错误
Call to undefined method Illuminate\Pagination\Paginator::make()
感谢任何帮助。
答案 0 :(得分:2)
该类不包含方法make()
。相反,将这些变量传递给构造函数。
$result_p = new Paginator($result, $resultsPerPage, $currentPage, $options);