laravel - Paginate merged queries -
i have 2 queries:
$posts = post::all(); $comments = comment:all();
which later merge:
$merge = $posts->merge($comments); $all = $merge->sortbydesc(function($result) { return $result->created_at; });
how can paginate result of merge? doing $all->paginate(25)
not work.
laravel 5:
in laravel 5 can done instantiating paginator:
$paginator = new illuminate\pagination\paginator($all, $perpage, $currentpage);
Comments
Post a Comment