merge two different query result in laravel code example
Example: 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());