Laravel Distinct Count
You may simply do the following:
Tablename::distinct()->count('name');
DB::table('tablename')->distinct()->count('name');
is the correct answer.
->distinct('name')does not work in Laravel.
you can simply replace get with count in this way:
$count = DB::table('tablename')->count(DB::raw('DISTINCT name'));
also can do:
DB::table('tablename')->distinct('name')->count('name');