merge 2 query results laravel code example
Example 1: join multiple query in laravel
$select->joinSub(
$selectSubQry,
'ag',
'ag.id',
'=',
'agp.userId'
);
Example 2: combine two query value in laravel 8
// get all film projects
$filmProjects= FilmProject::all();
// get all new media projects
$newMediaProjects= NewMediaProject::all();
// merge projects,
foreach($filmProjects as $filmProject) {
$newMediaProjects->add($filmProject);
}
// or we can also do this $newMediaProjects->toBase()->merge($filmProjects);
dd($newMediaProjects->toArray());