Reputation: 107
I have a union query from 2 different tables which I have to run through raw query. But I am facing a problem in paginatig the result. Here's what I have done
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'));
}
}
This gives an error
Call to undefined method Illuminate\Pagination\Paginator::make()
Any help is appreciated.
Upvotes: 2
Views: 2202
Reputation: 33048
That class does not contain the method make()
. Instead, pass those variables to the constructor.
$result_p = new Paginator($result, $resultsPerPage, $currentPage, $options);
Upvotes: 2