I am trying to count how many projects i have in the projects table. So, my code gets the count of project with the specific id.
I simply want to count over all projects that exist in my table.
public function countProjects()
$count = Projects::where('id','0')->count();
return view('projects.test')->with('count', $count);
You should be able to just remove the where.
$count = Projects::count();
where() builder method returns
$this after attaching the criteria, in order to allow method chaining. So if you eliminate it, you will still be calling
count() on the model.