1Sometime for such queries you need to disable the strict check
2 So inside config/database.php and inside mysql,
3 Set 'strict' => false,
4
5->select('user_id', DB::raw('SUM(points) as total_points'))
1$users = DB::table('users')
2 ->join('contacts', 'users.id', '=', 'contacts.user_id')
3 ->join('orders', 'users.id', '=', 'orders.user_id')
4 ->select('users.*', 'contacts.phone', 'orders.price')
5 ->get();
1DB::table('users')
2 ->where('name', '=', 'John')
3 ->where(function ($query) {
4 $query->where('votes', '>', 100)
5 ->orWhere('title', '=', 'Admin');
6 })
7 ->get();