- nner Join
DB::table('admin') ->join('contacts', 'admin.id', '=', 'contacts.user_id') ->join('orders', 'admin.id', '=', 'orders.user_id') ->select('users.id', 'contacts.phone', 'orders.price') ->get(); - Left Join / Right Join
$users = DB::table('admin') ->leftJoin('posts', 'admin.id', '=', 'posts.admin_id') ->get();
$users = DB::table('admin') ->rightJoin('posts', 'admin.id', '=', 'posts.admin_id') ->get(); - Cross Join
$user = DB::table('sizes') ->crossJoin('colours') ->get(); - Advanced Join
DB::table('admin') ->join('contacts', function ($join) { $join->on('admin.id', '=', 'contacts.admin_id')->orOn(...); }) ->get(); - Sub-Query Joins
$admin = DB::table('admin') ->joinSub($latestPosts, '
Tuesday, March 10, 2020
Laravel join query examples
Subscribe to:
Post Comments (Atom)
-
✅ Step-by-Step: Install PostgreSQL via EDB Installer (No Brew) 🔗 1. Download the Installer Go to the official PostgreSQL download page:...
-
A Comment system is a primary requirement for blog website or any tutorial website. in this post i want to share with you how to create co...
-
https://www.positronx.io/build-secure-php-rest-api-in-laravel-with-sanctum-auth/
No comments:
Post a Comment