Anna.P
0
Q:

laravel where

$users = DB::table('users')
                    ->whereIn('id', [1, 2, 3])
                    ->get();
7
$latestPosts = DB::table('posts')
                   ->select('user_id', DB::raw('MAX(created_at) as last_post_created_at'))
                   ->where('is_published', true)
                   ->groupBy('user_id');

$users = DB::table('users')
        ->joinSub($latestPosts, 'latest_posts', function ($join) {
            $join->on('users.id', '=', 'latest_posts.user_id');
        })->get();
2
$users = DB::table('users')
                ->whereMonth('created_at', '12')
                ->get();
1
$affected = DB::table('users')
              ->where('id', 1)
              ->update(['votes' => 1]);
0
Table::where('Column', Value)->where('NewColumn', Value)->get();
0
$users = DB::table('users')
                ->whereDate('created_at', '2016-12-31')
                ->get();
0
$users = DB::table('users')
                ->groupBy('account_id')
                ->having('account_id', '>', 100)
                ->get();
-1

New to Communities?

Join the community