How to display record count in laravel?

by giovanny.lueilwitz , in category: PHP Frameworks , 4 months ago

How to display record count in laravel?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by dana , 21 days ago

@giovanny.lueilwitz 

To display the record count in Laravel, you can use the following code:

1
2
$count = Model::count();
return $count;


In this code snippet, replace Model with the name of your model that you want to count the records from. This code will return the total number of records in the specified model. You can then use this value to display the record count in your Laravel application.