join query in laravel with model code example
Example 1: join in laravel eloquent
$customer = DB::table('customers')
->join('shops', 'customers.shop_id', '=', 'shops.shop_id')
->where('customer_contact', $contact_no)
->get();
Example 2: join in laravel
$subCategories = Subcategory::join('categories', 'subcategories.category_id', '=', 'categories.id')
->select('subcategories.*', 'categories.name AS cname')
->orderBy('id', 'desc')
->get();