“laravel join 2 tables eloquent” Coderfunda Code Answer’s
join multiple tables in laravel eloquent
1
laravel join 2 tables eloquent
1
Programing Coderfunda January 25, 2022 Laravel, php No comments
use Illuminate\Support\Facades\DB;
$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();
$users = User::join('posts', 'posts.user_id', '=', 'users.id')
->where('users.status', 'active')
->where('posts.status','active')
->get(['users.*', 'posts.descrption']);
$select->joinSub(
$selectSubQry,
'ag',
'ag.id',
'=',
'agp.userId'
);
0 comments:
Post a Comment
Thanks