laravel update from query
$affected = DB::table('users')
->where('id', 1)
->update(['votes' => 1]);
laravel update from query
$affected = DB::table('users')
->where('id', 1)
->update(['votes' => 1]);
laravel wher in
$users = DB::table('users')
->whereIn('id', [1, 2, 3])
->get();
laravel join
$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();
where in laravel
$users = Users::whereIn('id', array(1, 2, 3))->get()
laravel where
$users = DB::table('users')
->whereDate('created_at', '2016-12-31')
->get();
laravel where
$users = DB::table('users')
->whereMonth('created_at', '12')
->get();
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us