File tree Expand file tree Collapse file tree 4 files changed +65
-4
lines changed
Resources/ActivityLogs/Tables Expand file tree Collapse file tree 4 files changed +65
-4
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,21 @@ All notable changes to `filament-activity-log` will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and 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
Original file line number Diff line number Diff line change 77use AlizHarb \ActivityLog \ActivityLogPlugin ;
88use AlizHarb \ActivityLog \Models \Activity ;
99use AlizHarb \ActivityLog \Resources \ActivityLogs \ActivityLogResource ;
10+ use AlizHarb \ActivityLog \Support \ActivityLogCauser ;
11+ use AlizHarb \ActivityLog \Support \ActivityLogTitle ;
1012use Filament \Pages \Page ;
1113use Filament \Tables \Columns \TextColumn ;
1214use 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
Original file line number Diff line number Diff line change 1414use Filament \Actions \DeleteBulkAction ;
1515use Filament \Actions \ExportAction as FilamentExportAction ;
1616use Filament \Actions \ViewAction ;
17+ use AlizHarb \ActivityLog \Models \Activity ;
18+ use AlizHarb \ActivityLog \Support \ActivityLogCauser ;
1719use Filament \Facades \Filament ;
1820use Filament \Forms \Components \Checkbox ;
1921use Filament \Forms \Components \DatePicker ;
2426use Filament \Tables \Table ;
2527use Illuminate \Database \Eloquent \Builder ;
2628use 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 }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments