php - Count how many projects are in the projects table -
i trying count how many projects have in projects table. code gets count of project specific id.
i want count on all projects exist in table.
controller code:
public function countprojects() { $count = projects::where('id','0')->count(); return view('projects.test')->with('count', $count); }
you should able remove where.
$count = projects::count();
the where()
builder method returns $this
after attaching criteria, in order allow method chaining. if eliminate it, still calling count()
on model.
Comments
Post a Comment