|
10 | 10 | use Illuminate\Support\Facades\View; |
11 | 11 | use Kirschbaum\Commentions\Comment as CommentModel; |
12 | 12 | use Kirschbaum\Commentions\Events\UserWasMentionedEvent; |
| 13 | +use Kirschbaum\Commentions\Filament\Actions\TableAction; |
13 | 14 | use Kirschbaum\Commentions\Listeners\SendUserMentionedNotification; |
14 | 15 | use Kirschbaum\Commentions\Livewire\Comment; |
15 | 16 | use Kirschbaum\Commentions\Livewire\CommentList; |
@@ -44,6 +45,11 @@ public function configurePackage(Package $package): void |
44 | 45 | ]); |
45 | 46 | } |
46 | 47 |
|
| 48 | + public function packageRegistered(): void |
| 49 | + { |
| 50 | + $this->aliasTableAction(); |
| 51 | + } |
| 52 | + |
47 | 53 | public function packageBooted(): void |
48 | 54 | { |
49 | 55 | $prefix = Config::getComponentPrefix(); |
@@ -83,4 +89,24 @@ public function packageBooted(): void |
83 | 89 | Event::listen(UserWasMentionedEvent::class, $listenerClass); |
84 | 90 | } |
85 | 91 | } |
| 92 | + |
| 93 | + /** |
| 94 | + * Bridge the package's {@see TableAction} to the correct Filament base class. |
| 95 | + * |
| 96 | + * Filament 4 unified actions under `Filament\Actions\Action`, removing the |
| 97 | + * `Filament\Tables\Actions\Action` base that table actions extend on |
| 98 | + * Filament 3. The bundled TableAction class already extends the unified base |
| 99 | + * (correct for Filament 4/5); on Filament 3 it must instead resolve to the |
| 100 | + * legacy table-action base, so alias it before CommentsTableAction loads. |
| 101 | + */ |
| 102 | + protected function aliasTableAction(): void |
| 103 | + { |
| 104 | + if (class_exists(TableAction::class, false)) { |
| 105 | + return; |
| 106 | + } |
| 107 | + |
| 108 | + if (class_exists('Filament\Tables\Actions\Action')) { |
| 109 | + class_alias('Filament\Tables\Actions\Action', TableAction::class); |
| 110 | + } |
| 111 | + } |
86 | 112 | } |
0 commit comments