Please am trying to display student count from my database into the H3 Tag( The Number of rows ) in my dashboard.blade.php . I want to display the number of students in the database when the dashboard opens. i have tried my very best but it isn't working out for me. I need help. Below is what i have done so far. Thanks
<span>
<img src="{{ asset('images/studentIcon.png') }}" style="width: 70px; height: 70px; border-radius: 50%">
<h3 style="color: red"> echo $displaycount </h3>
<p class="cardtext">Registered Students</p>
</span>
This my route
Route::get('/dashboard', 'StudentRegister@getCount');
StudentRegister.php controller file Model File Name is Student
public function getCount(){
$nStudents = Student::where 1;
$displaycount = $nStudents->count();
}
I think you have a syntax error, can you try this one:
$nStudents = Student::where('id', '<=', $correctedComparisons)->count();
Or (in case you don't have any condition to filter about)
$count = Student::count();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.