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

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -