1Inner Join : ->join('contacts', 'users.id', '=', 'contacts.user_id')
2Left Join : ->leftJoin('posts', 'users.id', '=', 'posts.user_id')
3Right Join : ->rightJoin('posts', 'users.id', '=', 'posts.user_id')
4Cross Join : ->crossJoin('colors')
5
6Advance Queries :
7-----------------
8 ->join('contacts', function ($join) {
9 $join->on('users.id', '=', 'contacts.user_id')
10 ->where('contacts.user_id', '>', 5);
11 })
12
1$affected = DB::table('users')
2 ->where('id', 1)
3 ->update(['votes' => 1]);
1$camps = $field->camps()->where('status', 0)->where(function ($q) {
2 $q->where('sex', Auth::user()->sex)->orWhere('sex', 0);
3})->get();