Laravel Combine two DB query results Example

Today, We want to share with you Laravel Combine two DB query results Example.In this post we will show you concat two columns in laravel 6 query, hear for laravel 6 join two tables using model we will give you demo and example for implement.In this post, we will learn about laravel 6 left join with relationships with an example.

Laravel Combine two DB query results Example

There are the Following The simple About Laravel Combine two DB query results Example Full Information With Example and source code.

Read Also:  PHP Upload and Crop Image using jQuery Ajax

As I will cover this Post with live Working example to develop laravel 6 select from multiple tables, so the join query in laravel 6 controller is used for this example is following below.

Combine two tables into one result set.

Laravel 6 merge/append/join

// get all film members
$filmMembers= FilmMember::all();
// get all new media members
$newMediaMembers=  NewMediaMember::all();
// merge members,
foreach($filmMembers as $filmMember) {
// or we can also do this $newMediaMembers->toBase()->merge($filmMembers);

Laravel 6 :: Combine two DB query objects

using merge() : app/routes.php


Route::get('/', function()
    $a = FilmMember::where('status','enable')
    $b = FilmMember::where('status','padding')

    $result = $a->merge($b);

        echo $row->title.'<br />';

Web Programming Tutorials Example with Demo

Read :

Read Also:  Nodejs Login and Registration with PHP MySQL and SQLite Example


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

I hope you get an idea about laravel merge two collections.
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.

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  how to get the selected value of dropdown in php without submit?
  2. Read Also:  vue localStorage using Vuex Example
  3. Read Also:  Create Laravel Live Search Using Ajax
  4. Read Also:  Laravel 6 drop column if exists MySQL using Migration
  5. Read Also:  Laravel 5.8 Merge Multiple Collection Paginate
  6. Read Also:  laravel get all table names
  7. Read Also:  NodeJS Login and Registration Authentication using mysql
  8. Read Also:  Custom Helper Functions in Laravel 6 Example
  9. Read Also:  How to send email in php? | php code to send email on button click
  10. Read Also:  Laravel Group by not working - LIMIT or GROUP BY with prepared statement not working