mayaram/spatie-activitylog-ui
Beautiful, modern UI for Spatie's Laravel Activity Log. Browse table, timeline, and analytics dashboards with powerful filters, saved views, and CSV, Excel, PDF, or JSON exports. Built with Tailwind and Alpine, no build step required.
composer require mayaram/spatie-activitylog-ui
php artisan vendor:publish --provider="Mayaram\ActivityLogUI\ActivityLogUIServiceProvider" --tag="activity-log-ui-config"
php artisan vendor:publish --provider="Mayaram\ActivityLogUI\ActivityLogUIServiceProvider" --tag="activity-log-ui-assets"
routes/web.php:
use Mayaram\ActivityLogUI\Http\Controllers\ActivityLogController;
Route::middleware(['auth'])->group(function () {
Route::get('/activity-log', [ActivityLogController::class, 'index'])->name('activity-log.index');
});
php artisan migrate
/activity-log after authentication.user:admin, event:created) to narrow results.Dashboard Customization
php artisan vendor:publish --provider="Mayaram\ActivityLogUI\ActivityLogUIServiceProvider" --tag="activity-log-ui-views"
resources/views/vendor/activity-log-ui/dashboard.blade.php to add custom widgets or layouts.Filtering & Search
// In a custom controller method
$query = ActivityLog::query();
if ($request->filled('user')) {
$query->where('properties->user', 'like', "%{$request->user}%");
}
return ActivityLogController::applyFilters($query, $request)->get();
Real-Time Updates
// In your frontend JS
Echo.channel('activity-log-updates')
.listen('ActivityUpdated', (e) => {
// Refresh UI or show toast
});
Export Integration
composer require maatwebsite/excel dompdf/laravel-dompdf
$export = new \Mayaram\ActivityLogUI\Exports\ActivityLogExport($query);
return Excel::download($export, 'activity_log.xlsx');
can:view-activity-log gate or middleware:
Gate::define('view-activity-log', function ($user) {
return $user->isAdmin(); // Custom logic
});
Activity::log('custom.event', $subject)
->withProperties(['custom_field' => 'value']);
Route::get('/api/activity-log', [ActivityLogController::class, 'apiIndex']);
Database Schema Mismatch
activity_log table matches Spatie v5 schema. Run:
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-migrations"
php artisan migrate
Column 'properties' not found → Re-run migrations or manually add missing columns.Caching Issues
php artisan cache:clear
ACTIVITY_LOG_UI_CACHE=false
Alpine.js Conflicts
<div x-data="{ open: false }" x-show="open" @click.away="open = false">
<!-- Filter panel -->
</div>
Export Dependencies
maatwebsite/excel or dompdf/laravel-dompdf will break export buttons.composer.json and run composer install.DB::enableQueryLog();
$query = ActivityLog::query()->where(...);
dd(DB::getQueryLog());
Activity::log('test.event', $model)->withProperties(['debug' => true]);
Check the database or use Tinker:
php artisan tinker
>> \Spatie\Activitylog\Models\Activity::latest()->first()->properties;
Custom Filters
public function boot()
{
ActivityLogUI::extendFilters(function ($builder) {
$builder->addFilter('status', 'Status', 'select', ['draft', 'published']);
});
}
Timeline View
php artisan vendor:publish --provider="Mayaram\ActivityLogUI\ActivityLogUIServiceProvider" --tag="activity-log-ui-views"
resources/views/vendor/activity-log-ui/timeline.blade.php.Analytics Dashboard
// In your dashboard blade
<canvas id="activityChart"></canvas>
<script>
new Chart(document.getElementById('activityChart'), {
type: 'bar',
data: {
labels: @json($labels),
datasets: [{
label: 'Activity Count',
data: @json($data)
}]
}
});
</script>
Middleware Hooks
public function handle($request, Closure $next)
{
if ($request->user()->cannot('view-activity-log')) {
abort(403);
}
return $next($request);
}
How can I help you explore Laravel packages today?