combine two query value in laravel 8

Solutions on MaxInterview for combine two query value in laravel 8 by the best coders in the world

showing results for - "combine two query value in laravel 8"
Francesca
12 Sep 2019
1
2// get all film projects
3$filmProjects= FilmProject::all();
4 
5// get all new media projects
6$newMediaProjects=  NewMediaProject::all();
7 
8// merge projects,
9foreach($filmProjects as $filmProject) {
10    $newMediaProjects->add($filmProject);
11}
12 
13// or we can also do this $newMediaProjects->toBase()->merge($filmProjects);
14 
15dd($newMediaProjects->toArray());