eloquent laravel: How to get a row count from a ->get()

后端 未结 4 1302
花落未央
花落未央 2021-02-02 05:32

I\'m having a lot of trouble figuring out how to use this collection to count rows.

$wordlist = \\DB::table(\'wordlist\')->where(\'id\', \'<=\', $correcte         


        
4条回答
  •  失恋的感觉
    2021-02-02 05:40

    Its better to access the count with the laravels count method

    $count = Model::where('status','=','1')->count();
    

    or

    $count = Model::count();
    

提交回复
热议问题