1DB::table('users')
2 ->join('contacts', 'users.id', '=', 'contacts.user_id')
3 ->join('orders', 'users.id', '=', 'orders.user_id')
4 ->select('users.id', 'contacts.phone', 'orders.price')
5 ->get();
1$areas = Area::select('areas.*', DB::raw('count(area_id) as connections'))
2 ->leftJoin('object_areas', 'object_areas.area_id', '=', 'areas.id')
3 ->groupBy('areas.id')
4 ->get();
1DB::table('users')
2 ->join('contacts', function($join)
3 {
4 $join->on('users.id', '=', 'contacts.user_id')->orOn(...);
5 })
6 ->get();
1DB::table('users')
2 ->leftJoin('posts', 'users.id', '=', 'posts.user_id')
3 ->get();