laravel eloquent leftjoin code example
Example 1: left join laravel
$users = DB::table('users')
->leftJoin('posts', 'users.id', '=', 'posts.user_id')
->get();
$users = DB::table('users')
->rightJoin('posts', 'users.id', '=', 'posts.user_id')
->get();
Example 2: join in laravel eloquent
$customer = DB::table('customers')
->join('shops', 'customers.shop_id', '=', 'shops.shop_id')
->where('customer_contact', $contact_no)
->get();