How can I display the number of rows in all database tables at the same time?
i dont want to write code like this
public function index()
{
$mobiles = Mobile::count();
$users = User::where('is_admin', 'no')->count();
$users_admin = User::where('is_admin', 'yes')->count();
$phonebooks = phonebook::count();
// and many tables count in here
return view('dashboard.superAdmin.database.index', compact(
'mobiles',
'users',
'users_admin',
'phonebooks'
));
}
Is there a way to do this write in low line of codes?