Skip to content
Advertisement

Laravel list with unique values and count of values

Im trying show unique values from database with count of them in table view. But i have problem count them.

JavaScript

my goal is show in table

JavaScript

my controller

JavaScript

dd($userList) show 1 john and 1 smith

dashboard.blade

JavaScript

error : Call to undefined method stdClass::count()

Advertisement

Answer

Use this code:

JavaScript

And in your blade use this code:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement