Menu

My dashboard's "recent users" section is the admin table with the buttons turned off
πŸ“°

My dashboard's "recent users" section is the admin table with the buttons turned off

DEV Community: laravelΒ·Kamran KhanΒ·4 days ago
#8iiAQPDi
#devtolaravel#devto#dev#users#component
Reading 0:00
15s threshold

On my dashboard, admins see a "Recent users" section under the stat cards. It is not a new component. It is the same UsersTable the admin Users page uses, rendered with dead handlers:

< UsersTable users = { recentUsers } onEdit = { () => {} } onDelete = { () => {} } />

Enter fullscreen mode

Exit fullscreen mode

UsersTable is a dumb component: it takes a list and two callbacks. Hand it real callbacks and you get the admin table. Hand it no-ops and the edit/delete buttons fire into the void, so it renders as a read-only list. Same markup, same columns, zero extra code.

The data comes from the same endpoint too:

client . get ( ' /users ' , { params : { per_page : 5 } })

Enter fullscreen mode

Exit fullscreen mode

One honest note: my backend index() is User::query()->latest()->paginate(15) , so it currently ignores per_page and returns the first page of 15, newest first. The param is there for when I wire it up server-side.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.