Laravel 5.8 Merge Multiple Collection Paginate

Today, We want to share with you Laravel 5.8 Merge Multiple Collection Paginate.In this post we will show you laravel resource collection pagination, hear for Merge Multiple Collection Paginate in Laravel Example we will give you demo and example for implement.In this post, we will learn about laravel merge two collections with an example.

Laravel 5.8 Merge Multiple Collection Paginate

There are the Following The simple About Laravel 5.8 Merge Multiple Collection Paginate Full Information With Example and source code.

Also Read This πŸ‘‰   PHP Shorthand Ternary Operator Examples

As I will cover this Post with live Working example to develop merge multiple collections laravel 5.8, so the some laravel 5.7, 5.8 paginate collection for this example is following below.

Merge multiple collections laravel 5.8


Route::get('collection-array', function(){
	$member = \App\Member::get();
	$student = \App\Student::get();
	$data = $member->merge($student)->paginate(10);

After that, simple We need to register a ServiceProvider Like a collection paginate method on AppServiceProvider main file.


//Laravel Include namespace 
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
    public function register()
         * Paginate a standard Laravel Collection.
         * @param int $perPage display row
         * @param int $total all records
         * @param int $page all pages
         * @param string $pageName your live page name
         * @return array
        Collection::macro('paginate', function($perPage, $total = null, $page = null, $pageName = 'page') {
            $page = $page ?: LengthAwarePaginator::resolveCurrentPage($pageName);
            return new LengthAwarePaginator(
                $this->forPage($page, $perPage),
                $total ?: $this->count(),
                    'path' => LengthAwarePaginator::resolveCurrentPath(),
                    'pageName' => $pageName,

    public function boot()

Angular 6 CRUD Operations Application Tutorials

Read :

Also Read This πŸ‘‰   Most Useful Laravel String Functions(helpers)


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel 5.8 Merge Multiple Collection Paginate.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.