Answers for "get data from 2 table in response laravel"

PHP
0

get data from 2 table in response laravel

$p1 = DB::table('properties')
        ->where('address', 'test')
        ->select('name', 'address');

$p2 = DB::table('properties_x')
         ->where('address', 'test')
         ->select('name', 'address');

$p = $p1->unionAll($p2);

DB::table(DB::raw("({$p->toSql()}) AS p"))
->mergeBindings($p)
->select('name', 'address')
->paginate(10);
Posted by: Guest on February-09-2021

Code answers related to "get data from 2 table in response laravel"

Browse Popular Code Answers by Language