Data-driven Dashboard

May 30, 2026 · View on GitHub

The bundled demo dashboard mirrors the AdminLTE HTML index with static numbers. The dashboard scaffold replaces those with real aggregates computed from whatever sections you've installed.

php artisan adminlte:scaffold dashboard

Publishes a DashboardController + resources/views/adminlte/dashboard/index.blade.php and the route adminlte.dashboard (/admin/dashboard), plus a DashboardTest.

What it shows

WidgetSource
Users stat boxusers count
Projects stat boxadminlte_projects count
Unread messages stat boxadminlte_messages where is_read = false
Upcoming events stat boxadminlte_events where start_at >= now()
Projects-by-status barsgrouped count over adminlte_projects.status
Recent activity feedlatest activity_log rows

Every metric is guarded by Schema::hasTable() / hasColumn(), so the dashboard renders correctly whether you've scaffolded one section or all of them — counts simply read 0 for sections you haven't installed. The stat boxes deep-link to the relevant section when its route exists.

Making it your home page

The scaffold registers /admin/dashboard. Point your root route at the same controller to use it as the landing page:

// routes/web.php
use App\Http\Controllers\AdminLte\DashboardController;

Route::get('/', [DashboardController::class, 'index'])->middleware('auth');

Extend DashboardController with your own metrics — it's plain Eloquent/Query Builder and fully yours to edit.