Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

anonymouse703's avatar

No user name (id) on the table and view

I implemented spatie activity log and add this plugin https://filamentphp.com/plugins/rmsramos-activitylog#spatielaravel-activitylog-for-filament for display

My problem is is that no user in the list and when you view user's activity i'ts empty since no causer_id was associated

Replicate:

Admin Panel

I just add the following

 ->plugins([
                ActivitylogPlugin::make()
                    ->navigationCountBadge(true)
            ]);

on the UserResource I add view actions

->actions([
	ActivityLogTimelineTableAction::make('Activities')
                    ->timelineIcons([
                        'created' => 'heroicon-m-check-badge',
                        'updated' => 'heroicon-m-pencil-square',
                    ])
                    ->timelineIconColors([
                        'created' => 'info',
                        'updated' => 'warning',
                    ])
                    ->limit(10),
])

since no causer_id was associated no data is displayed.

0 likes
1 reply
anonymouse703's avatar
anonymouse703
OP
Best Answer
Level 6

Solved:

Replicate:

Since the user model has change the user name. I also updated the ActivityResource

public static function getCauserNameColumnCompoment(): Column
    {
        return TextColumn::make('causer.full_name')
            ->label(__('activitylog::tables.columns.causer.label'))
            ->getStateUsing(function (Model $record) {
                if ($record->causer_id == null) {
                    return new HtmlString('—');
                }

                return $record->causer->full_name ?: new HtmlString('—');
            })
            ->searchable(query: function ($query, $search) {
                $query->whereHas('causer', function ($q) use ($search) {
                    $q->where('first_name', 'like', "%{$search}%")
                        ->orWhere('last_name', 'like', "%{$search}%")
                        ->orWhere('middle_name', 'like', "%{$search}%");
                });
            });
    }

Please or to participate in this conversation.