laravel query count raw 1

laravel query count raw

$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();

Here is what the above code is Doing:
1. We’re selecting all users.
2. We’re joining the contacts table on the user_id column of both tables.
3. We’re joining the orders table on the user_id column of both tables.
4. We’re selecting the users.* columns, the contacts.phone column, and the orders.price column.
5. We’re getting the results.

Similar Posts