Answers for "count laravel query"

PHP
1

select sum in laravel

Sometime for such queries you need to disable the strict check
 So inside config/database.php and inside mysql, 
 Set 'strict' => false,

->select('user_id', DB::raw('SUM(points) as total_points'))
Posted by: Guest on August-13-2020
6

get count laravel

$count = Model::where('status','=','1')->count();
Posted by: Guest on May-12-2020
7

laravel wher in

$users = DB::table('users')
                    ->whereIn('id', [1, 2, 3])
                    ->get();
Posted by: Guest on April-30-2020
0

laravel select count

$count = DB::table('category_issue')->count();
Posted by: Guest on July-06-2020
2

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();
Posted by: Guest on August-13-2020
2

DB::table('users')->get();

DB::select('SELECT * FROM users WHERE name = ?', array(Input::get('name')));
Posted by: Guest on October-22-2020

Browse Popular Code Answers by Language