Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #data #table #response #laravel
ADD COMMENT
Topic
Name
9+1 =