From 85bbc1d35fa921dbdded1c98ca2ece6238af2b5e Mon Sep 17 00:00:00 2001 From: Tony Partridge Date: Thu, 3 Aug 2023 12:15:42 +0100 Subject: [PATCH 1/5] Enforce Filament V3 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index eb610d0..f80fbb0 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ ], "require": { "php": "^8.0", - "filament/filament": "^2.9.15", + "filament/filament": "^3.0.5.0", "spatie/laravel-activitylog": "^4.7" }, "autoload": { From d7479a8901934fc29831f0463ad79572f19c5d09 Mon Sep 17 00:00:00 2001 From: Tony Partridge Date: Thu, 3 Aug 2023 12:16:49 +0100 Subject: [PATCH 2/5] Migrate FilamentActivityLogServiceProvider --- src/FilamentActivityLogServiceProvider.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FilamentActivityLogServiceProvider.php b/src/FilamentActivityLogServiceProvider.php index 6d6558a..c5dd122 100644 --- a/src/FilamentActivityLogServiceProvider.php +++ b/src/FilamentActivityLogServiceProvider.php @@ -2,10 +2,10 @@ namespace pxlrbt\FilamentActivityLog; -use Filament\PluginServiceProvider; use Spatie\LaravelPackageTools\Package; +use Spatie\LaravelPackageTools\PackageServiceProvider; -class FilamentActivityLogServiceProvider extends PluginServiceProvider +class FilamentActivityLogServiceProvider extends PackageServiceProvider { public static string $name = 'filament-activity-log'; From fc157da964f46e4319c4328ed42f36ae36b1b1e4 Mon Sep 17 00:00:00 2001 From: Tony Partridge Date: Thu, 3 Aug 2023 12:22:49 +0100 Subject: [PATCH 3/5] Migrate ListActivities.php to V3 --- src/Pages/ListActivities.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Pages/ListActivities.php b/src/Pages/ListActivities.php index 93d86e4..43414ac 100644 --- a/src/Pages/ListActivities.php +++ b/src/Pages/ListActivities.php @@ -4,18 +4,20 @@ use Filament\Forms\Components\Field; use Filament\Forms\Components\MorphToSelect; -use Filament\Resources\Form; -use Filament\Resources\Pages\Concerns\HasRecordBreadcrumb; +use Filament\Forms\Form; +use Filament\Pages\Concerns\InteractsWithFormActions; use Filament\Resources\Pages\Concerns\InteractsWithRecord; use Filament\Resources\Pages\Page; use Filament\Tables\Concerns\CanPaginateRecords; use Illuminate\Support\Collection; +use Livewire\Features\SupportPagination\HandlesPagination; -abstract class ListActivities extends Page +abstract class ListActivities extends Page implements HasForms { - use InteractsWithRecord; use CanPaginateRecords; + use HandlesPagination; use HasRecordBreadcrumb; + use InteractsWithRecord; protected static string $view = 'filament-activity-log::pages.list-activities'; @@ -47,7 +49,7 @@ public function getFieldLabel(string $name): string protected function createFieldLabelMap(): Collection { - $form = static::getResource()::form(new Form()); + $form = static::getResource()::form(new Form($this)); $components = collect($form->getSchema()); $extracted = collect(); From 48645992f602f1511860a469bb4dc7e4e30bffd6 Mon Sep 17 00:00:00 2001 From: Tony Partridge Date: Thu, 3 Aug 2023 12:23:22 +0100 Subject: [PATCH 4/5] Migrate list-activities.blade.php to V3 --- .../views/pages/list-activities.blade.php | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/resources/views/pages/list-activities.blade.php b/resources/views/pages/list-activities.blade.php index 22d6fc6..6aa06b9 100644 --- a/resources/views/pages/list-activities.blade.php +++ b/resources/views/pages/list-activities.blade.php @@ -1,4 +1,4 @@ - +
@foreach($this->getActivities() as $activityItem)
@if ($activityItem->causer) - + {{ $activityItem->causer?->name }} @endif
@@ -20,19 +20,19 @@
- +
- + - + @lang('filament-activity-log::activities.table.field') - - + + @lang('filament-activity-log::activities.table.old') - - + + @lang('filament-activity-log::activities.table.new') - + @php /* @var \Spatie\Activitylog\Models\Activity $activityItem */ @@ -43,33 +43,34 @@ $oldValue = data_get($changes, "old.{$field}"); $newValue = data_get($changes, "attributes.{$field}"); @endphp - $loop->even])> - + $loop->even])> + {{ $this->getFieldLabel($field) }} - - + + @if(is_array($oldValue))
{{ json_encode($oldValue, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) }}
@else {{ $oldValue }} @endif -
- + + @if(is_array($newValue))
{{ json_encode($newValue, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) }}
@else {{ $newValue }} @endif -
-
+ + @endforeach -
+ @endforeach - + -
+ From a128491d2ce84cb4e380b627ee88c08ade53ab8b Mon Sep 17 00:00:00 2001 From: Tony Partridge Date: Thu, 3 Aug 2023 12:32:35 +0100 Subject: [PATCH 5/5] Migrate ListActivities to V3 --- src/Pages/ListActivities.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Pages/ListActivities.php b/src/Pages/ListActivities.php index 43414ac..f24d090 100644 --- a/src/Pages/ListActivities.php +++ b/src/Pages/ListActivities.php @@ -11,13 +11,14 @@ use Filament\Tables\Concerns\CanPaginateRecords; use Illuminate\Support\Collection; use Livewire\Features\SupportPagination\HandlesPagination; +use Filament\Forms\Contracts\HasForms; abstract class ListActivities extends Page implements HasForms { use CanPaginateRecords; use HandlesPagination; - use HasRecordBreadcrumb; use InteractsWithRecord; + use InteractsWithFormActions; protected static string $view = 'filament-activity-log::pages.list-activities'; @@ -51,7 +52,7 @@ protected function createFieldLabelMap(): Collection { $form = static::getResource()::form(new Form($this)); - $components = collect($form->getSchema()); + $components = collect($form->getComponents()); $extracted = collect(); while (($component = $components->shift()) !== null) {