Getting Started
Quick start
Working timeline in 5 minutes — Person model, spatie log, infolist render.
The smallest end-to-end path: log activity on one model with spatie, mount the timeline infolist on its Filament resource, watch entries appear. Once it works, see /essentials/sources to compose more sources.
Prerequisites
- Package installed (
composer require relaticle/activity-log) — see /getting-started/installation. spatie/laravel-activitylog'sactivity_logtable migrated.- At least one Filament resource ready to host the timeline (this guide uses
PersonResource).
Step 1 — Make a model timeline-capable
app/Models/Person.php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Relaticle\ActivityLog\Concerns\InteractsWithTimeline;
use Relaticle\ActivityLog\Contracts\HasTimeline;
use Relaticle\ActivityLog\Timeline\TimelineBuilder;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
final class Person extends Model implements HasTimeline
{
use InteractsWithTimeline;
use LogsActivity;
protected $fillable = ['name', 'email'];
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logFillable();
}
public function timeline(): TimelineBuilder
{
return TimelineBuilder::make($this)->fromActivityLog();
}
}
LogsActivity (paired with getActivitylogOptions) makes spatie record create / update / delete events into the activity_log table. HasTimeline plus the InteractsWithTimeline trait give you timeline(), paginateTimeline(), and forgetTimelineCache() on the model. fromActivityLog() is the simplest source — the subject's own log.
Step 2 — Render the timeline on the resource view page
app/Filament/Resources/PersonResource.php
namespace App\Filament\Resources;
use Filament\Schemas\Schema;
use Relaticle\ActivityLog\Filament\Infolists\Components\ActivityLog;
public function infolist(Schema $schema): Schema
{
return $schema->components([
// ... your existing entries
ActivityLog::make('activity')->columnSpanFull(),
]);
}
ActivityLog must live on a page that renders the model record (typically ViewRecord or EditRecord). The component reads the active record from the page context.Step 3 — Trigger an activity
Edit a Person via the Filament UI, or via tinker:
Terminal
php artisan tinker --execute 'App\Models\Person::find(1)->update(["name" => "New name"]);'
Refresh the view page — an entry titled "updated" appears, with the changed-fields diff inline (rendered by the built-in ActivityLogRenderer).
Where to next?
- Compose more sources — pull in events from related models (
fromActivityLogOf), timestamp columns (fromRelation), or external APIs (fromCustom). See /essentials/sources. - Use the relation manager or header action — alternative Filament surfaces for the timeline. See /essentials/filament-ui.
- Customize the rendering — replace the spatie diff renderer per event or wholesale. See /essentials/customization.
- See it in context — full real-world wiring patterns at /recipes/crm-person-feed.