人気のPHP WEBアプリケーションフレームワークLaravelのTipsを記録していきます

Laravel Eloquentで件数( count )の取得

● Laravel Eloquentで件数( count )の取得

$counts = \App\Estimate::where('project_status_id', '=', 30)->count();

実際に実行されるSQL文は次のようになります

   "query" => "select count(*) as aggregate from `estimates` where `project_status_id` = ?"
    "bindings" => [
      0 => 30
    ]
No.2031
08/27 09:13

edit