How can we reduce the query?

I have 4 different request, is it possible to combine into one, if you can help please

$users = DB::table('users')->where('id_access_code', '=', '1')->count();
 $orders = DB::table('order')->get()->count();
 $goods = DB::table('product')->get()->count();
 $admins = DB::table('users')->where('id_access_code', '>=', '2')->count();
April 3rd 20 at 17:42
2 answers
April 3rd 20 at 17:44
Solution
Take two ->get(), if you only need the number. Now you get a collection of all the recordings and then learn the size of the collection, and if you just count, it will be a regular COUNT query to the database, without loading all entities in a collection. And it will work faster.
But make really no sense.
April 3rd 20 at 17:46
Solution
Running faster will not, leave.

Find more questions by tags Laravel