Join Two Tables Query in Laravel

Friends, today I will tell you this through my article. How you can join 2 tables through laravel.

Join two tables Using laravel 7, join two tables query in laravel 6, laravel 5.8 Use join query for two table, join two tables query in laravel 5.7, join two tables query in laravel 5.6 Or 5.5 Or 5.4 and 5.3, 5.2, 5.1

If you want to join 2 table by laravel query. Then you can join table very easily. How to join two table by laravel below. The query of join is given below.

$join = DB::table('shares')
->join('users', 'users.id', '=', 'shares.user_id')
->get();

Join two tables query use with WHERE Condition

$join = DB::table('shares')
->join('users', 'users.id', '=', 'shares.user_id')
->where('shares.user_id', '=', 10)
->get();

Join two tables query use with Limit Condition

$join = DB::table('shares')
->join('users', 'users.id', '=', 'shares.user_id')
->where('shares.user_id', '=', 10)
->limit(5)
->get();