laravel get count by join code example
Example 1: join table laravel count
DB::table('users')
->join('contacts', 'users.id', '=', 'contacts.user_id')
->join('orders', 'users.id', '=', 'orders.user_id')
->select('users.id', 'contacts.phone', 'orders.price')
->get();
Example 2: join table laravel count
DB::table('users')
->leftJoin('posts', 'users.id', '=', 'posts.user_id')
->get();