php - Laravel 5 - DB join is returning just first table column set -


i have related mysql tables, , want obtain columns in of them, if try code manual, columns first table:

$users = db::table('users')             ->join('contacts', 'users.id', '=', 'contacts.user_id')             ->join('orders', 'users.id', '=', 'orders.user_id')             ->select('users.*', 'contacts.phone', 'orders.price')             ->get(); 

that columns 'users' table, not see contacts , orders columns.

try this

db::table('users')->join('contacts',function($join){$join->on('users.id','=','contacts.user_id')})->join('orders',function($join){$join->on('users.id','=','orders.user_id')})->get() 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -