Answers for "combine two query value in laravel 8"

PHP
0

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());
Posted by: Guest on February-04-2021

Browse Popular Code Answers by Language