get data from 2 table in response laravel

Solutions on MaxInterview for get data from 2 table in response laravel by the best coders in the world

showing results for - "get data from 2 table in response laravel"
Liam
05 Mar 2018
1$p1 = DB::table('properties')
2        ->where('address', 'test')
3        ->select('name', 'address');
4
5$p2 = DB::table('properties_x')
6         ->where('address', 'test')
7         ->select('name', 'address');
8
9$p = $p1->unionAll($p2);
10
11DB::table(DB::raw("({$p->toSql()}) AS p"))
12->mergeBindings($p)
13->select('name', 'address')
14->paginate(10);
15