Admin Dashboard
Platform stats, user management, role editing. Protected by middleware on both frontend and backend.
What's Included
Platform Stats
Total users, new users today/this week, verified accounts, subscription breakdown by plan.
User Management
Paginated list with search and filters. View user details, edit roles, toggle email verification.
Activity Feed
Real-time log of user actions: logins, registrations, profile updates, plan changes.
Role System
Type-safe PHP enum (Role::Admin, Role::User). Easily extendable.
Access Control
Admin routes are protected at every layer:
- Backend:
module:admin+role:adminmiddleware on all/api/admin/*routes - Frontend: Server-side role check in the layout, redirects non-admins to the dashboard
- Sidebar: Admin link only visible when
user.role === 'admin'
Tip
Seed the database with php artisan db:seed to get a pre-configured admin account: admin@stacktura.dev / password
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/stats | Platform statistics |
| GET | /api/admin/users | Paginated user list (search + filter) |
| GET | /api/admin/users/{id} | User detail |
| PATCH | /api/admin/users/{id}/role | Update role |
| PATCH | /api/admin/users/{id}/verification | Toggle email verification |
| GET | /api/admin/activity | Activity feed (paginated) |