2 years ago

Laravel - Show latest 5 Registered users

Posted 2 years ago by Rainieren

I'm trying to make a dashboard and I want to display the last 5 users that are registered on the site, So the most recent 5 registered people. How can I accomplish this? I need to have access to all their attributes, for instance, Name, Lastname etc.

This is my route: Route::get('/adminpanel', '[email protected]')->name('adminpanel');

And this is the controller:

    public function index()
        $tijd = Carbon::today();
        $posts = Post::count();
        $users = User::count();
        $replies = Reply::count();

        return view('admin.dashboard', compact('posts', 'users', 'replies', 'tijd'));


They need to be displayed in a table like this:

    <table class="table table-striped">
     <th scope="row">1</th>
     <td>[email protected]</td>

Thanks in advance

Please sign in or create an account to participate in this conversation.