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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -