Passing multiple variables to a single view Laravel

Passing multiple variables to a single view Laravel

In my controller:

In my controller:

public function index()
{
    $userTotal = User::all();
    $userActive = User::where('status', '=', 'Active');
    $userInactive = User::where('status', '=', 'Inactive');
    $userOnAndOff = User::where('status', '=', 'OnAndOff');

return view('member.home')
    ->with(compact('userTotal'))
    ->with(compact('userActive'))
    ->with(compact('userInactive'))
    ->with(compact('userOnAndOff'));

}

In my view:

<div class="card border-success">
    <div class="card-horizontal">
        <div class="card-body bg-success">
            <p class="card-text text-white bg-success text-md-center"><i class="fas fa-users fa-2x"></i></p>
        </div>
        <div class="card-body text-success">
            <p class="card-text">Registered Member: <strong>{{ $userTotal->count() }}</strong></p>
            <p class="card-text">Active Members: <strong>{{ $userActive->count() }}</strong></p>
            <p class="card-text">Active Members: <strong>{{ $userActive->count() }}</strong></p>
            <p class="card-text">Inactive Members: <strong>{{ $userInactive->count() }}</strong></p>
        </div>
    </div>
</div>

I am trying to print out count values, is there any better way to code the controller?

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Top Laravel Development Companies Reviews

Among the list of Best Laravel development companies, TopDevelopers has chosen the most acclaimed laravel developers for the visitors so as to make them avail the extremely wonderful service ever offered. The web development companies listed here...

Laravel Development Company | Hire Laravel Developer

Get a free quote for custom Laravel Development Services from a trusted Laravel web development company. Hire Laravel Developers now @ best affordable rates

Laravel Tutorial - Abusing Laravel

Laravel Tutorial - Abusing Laravel: In this talk, Gustavo takes a look at the importance of Unit Tests and how Dependency Injection, which is often not promoted by Laravel docs, can help to achieve Unit Testing.