Skip to content

Commit 71cae06

Browse files
committed
feat: release v1.3.1 with multi-panel auth provider fix
- 🛡️ Panel-Aware Causer: Introduced ActivityLogCauser to dynamically resolve user models via current Filament panel guards. - 🚀 Optimized Imports: Cleaned and simplified imports across UserActivitiesPage and ActivityLogTable. - ✅ Verification: 72/72 tests passing, verified logic for multi-auth environments.
1 parent 08e325e commit 71cae06

File tree

4 files changed

+65
-4
lines changed

4 files changed

+65
-4
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ All notable changes to `filament-activity-log` will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.3.1] - 2026-02-06
9+
10+
### Fixed
11+
12+
- **Multi-Panel Support** - Fixed an issue where Select filters and causer resolution failed in multi-panel applications using different auth guards.
13+
- Introduced `ActivityLogCauser` support class for dynamic model resolution based on current panel guard.
14+
- Refactored `UserActivitiesPage` and `ActivityLogTable` to use panel-aware causer resolution.
15+
- **Import Optimization** - Optimized and simplified imports across core resource components.
16+
17+
### Technical Details
18+
19+
- ✅ All 72 tests passed (Feature and Unit)
20+
- ✅ Verified panel-aware causer resolution logic
21+
- ✅ Code simplified and linted
22+
823
## [1.3.0] - 2026-01-31
924

1025
### Added

src/Pages/UserActivitiesPage.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
use AlizHarb\ActivityLog\ActivityLogPlugin;
88
use AlizHarb\ActivityLog\Models\Activity;
99
use AlizHarb\ActivityLog\Resources\ActivityLogs\ActivityLogResource;
10+
use AlizHarb\ActivityLog\Support\ActivityLogCauser;
11+
use AlizHarb\ActivityLog\Support\ActivityLogTitle;
1012
use Filament\Pages\Page;
1113
use Filament\Tables\Columns\TextColumn;
1214
use Filament\Tables\Concerns\InteractsWithTable;
@@ -149,9 +151,9 @@ public function table(Table $table): Table
149151
SelectFilter::make('causer_id')
150152
->label(__('filament-activity-log::activity.filter.causer'))
151153
->options(function () {
152-
$model = config('auth.providers.users.model');
154+
$model = ActivityLogCauser::resolveModelClass();
153155

154-
if (! class_exists($model)) {
156+
if (! $model || ! class_exists($model)) {
155157
return [];
156158
}
157159

src/Resources/ActivityLogs/Tables/ActivityLogTable.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use Filament\Actions\DeleteBulkAction;
1515
use Filament\Actions\ExportAction as FilamentExportAction;
1616
use Filament\Actions\ViewAction;
17+
use AlizHarb\ActivityLog\Models\Activity;
18+
use AlizHarb\ActivityLog\Support\ActivityLogCauser;
1719
use Filament\Facades\Filament;
1820
use Filament\Forms\Components\Checkbox;
1921
use Filament\Forms\Components\DatePicker;
@@ -24,7 +26,6 @@
2426
use Filament\Tables\Table;
2527
use Illuminate\Database\Eloquent\Builder;
2628
use Illuminate\Support\Facades\Gate;
27-
use Spatie\Activitylog\Models\Activity;
2829

2930
/**
3031
* Class ActivityLogTable
@@ -191,7 +192,7 @@ public static function configure(Table $table): Table
191192
SelectFilter::make('causer_id')
192193
->label(__('filament-activity-log::activity.table.filter.causer'))
193194
->options(function () {
194-
$causerClass = config('auth.providers.users.model');
195+
$causerClass = ActivityLogCauser::resolveModelClass();
195196
if (! $causerClass || ! class_exists($causerClass)) {
196197
return [];
197198
}

src/Support/ActivityLogCauser.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace AlizHarb\ActivityLog\Support;
6+
7+
use Filament\Facades\Filament;
8+
use Illuminate\Support\Facades\Auth;
9+
use Illuminate\Auth\EloquentUserProvider;
10+
11+
class ActivityLogCauser
12+
{
13+
/**
14+
* Resolve the causer model class.
15+
*
16+
* In multi-panel applications, it tries to get the model from the current panel's guard provider.
17+
* Falls back to the default Laravel user model configuration.
18+
*
19+
* @return class-string|null
20+
*/
21+
public static function resolveModelClass(): ?string
22+
{
23+
if (class_exists(Filament::class) && $panel = Filament::getCurrentPanel()) {
24+
$guardName = $panel->getAuthGuard();
25+
$guard = Auth::guard($guardName);
26+
27+
/** @phpstan-ignore-next-line */
28+
if (method_exists($guard, 'getProvider')) {
29+
/** @var \Illuminate\Contracts\Auth\UserProvider $provider */
30+
$provider = $guard->getProvider();
31+
32+
if ($provider instanceof EloquentUserProvider) {
33+
return $provider->getModel();
34+
}
35+
}
36+
}
37+
38+
/** @var class-string|null $model */
39+
$model = config('auth.providers.users.model');
40+
41+
return $model;
42+
}
43+
}

0 commit comments

Comments
 (0)