left join where laravel code example
Example 1: left join laravel
$users = DB::table('users')
->leftJoin('posts', 'users.id', '=', 'posts.user_id')
->get();
$users = DB::table('users')
->rightJoin('posts', 'users.id', '=', 'posts.user_id')
->get();
Example 2: laravel wher in
$users = DB::table('users')
->whereIn('id', [1, 2, 3])
->get();
Example 3: laravel outer join
->join('answers as answers', 'responses.answer_id', '=', 'answers.id', 'left outer')