Carbon is great for this. You could use something like:
$date = \Carbon\Carbon::today()->subDays(30);
$userRegisteredCount = \App\User::where('created_at', '>=', $date)
->where('status', 'approved')
->count();
$userRegistered = \App\User::where('created_at', '>=', $date)
->where('status', 'approved')
->get();
Then in your view you would use {{ $userRegisteredCount }}
Or if you wanted to list them you could change it to ->get()
@foreach ($userRegistered as $registered)
{{ $userRegistered->name }}
@endforeach
You can then just pass the variable inside compact in your view like so:-
return view(
'your_view_name',
compact
(
'userRegisteredCount'
'userRegistered'
)
);