From 805614a2a791a446232575f7e9991abff9628c25 Mon Sep 17 00:00:00 2001 From: "Ralph J. Smit" <59207045+ralphjsmit@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:11:34 +0100 Subject: [PATCH 1/4] Fix Heroicons in docs --- content/plugins/ralphjsmit-notifications-pro.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/plugins/ralphjsmit-notifications-pro.md b/content/plugins/ralphjsmit-notifications-pro.md index d6993219f..48e549090 100644 --- a/content/plugins/ralphjsmit-notifications-pro.md +++ b/content/plugins/ralphjsmit-notifications-pro.md @@ -482,7 +482,7 @@ return FilamentNotification::make() ->actions([ Action::make('View') ->url("https://github.com", true) - ->icon('heroicon-o-arrows-expand'), + ->icon('heroicon-o-arrows-pointing-out'), ]); ``` @@ -548,7 +548,7 @@ class TestWorkflowFailedNotification extends Notification implements AsFilamentN ->actions([ Action::make('View') ->url("https://github.com", true) - ->icon('heroicon-o-arrows-expand'), + ->icon('heroicon-o-arrows-pointing-out'), ]); } From db4aa8e049496e5f6dca6013845891f1fbea6bcf Mon Sep 17 00:00:00 2001 From: "Ralph J. Smit" <59207045+ralphjsmit@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:29:00 +0100 Subject: [PATCH 2/4] Fix example --- content/plugins/ralphjsmit-notifications-pro.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/content/plugins/ralphjsmit-notifications-pro.md b/content/plugins/ralphjsmit-notifications-pro.md index 48e549090..6e75d3bb5 100644 --- a/content/plugins/ralphjsmit-notifications-pro.md +++ b/content/plugins/ralphjsmit-notifications-pro.md @@ -376,6 +376,8 @@ However, if the `StoresNotificationInDatabase` doesn't work for you, you can alw ```php class TestNotification extends Notification implements AsFilamentNotification { + use StoresNotificationInDatabase; + public function __construct( public User $user, public string $message, @@ -408,6 +410,8 @@ class TestNotification extends Notification implements AsFilamentNotification return [ 'user_id_or_something' => $this->user->id, 'message' => $this->message, + // Some internal properties are required to store in the database. They will be provided by this method. + ...$this->getInternalToArray(), ]; } @@ -415,6 +419,8 @@ class TestNotification extends Notification implements AsFilamentNotification { return ['database', 'mail']; } + + // Implement a `toMail()` method to match the methods in `via()`... } ``` From ea5c0af0ca73ff15588de9518a55a82ff77b1bff Mon Sep 17 00:00:00 2001 From: "Ralph J. Smit" <59207045+ralphjsmit@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:30:04 +0100 Subject: [PATCH 3/4] Update ralphjsmit-notifications-pro.md --- content/plugins/ralphjsmit-notifications-pro.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/content/plugins/ralphjsmit-notifications-pro.md b/content/plugins/ralphjsmit-notifications-pro.md index 6e75d3bb5..fc41755ec 100644 --- a/content/plugins/ralphjsmit-notifications-pro.md +++ b/content/plugins/ralphjsmit-notifications-pro.md @@ -380,12 +380,13 @@ class TestNotification extends Notification implements AsFilamentNotification public function __construct( public User $user, - public string $message, + public string $customMessage, ) {} public static function toFilamentNotification(): FilamentNotification { return FilamentNotification::make() + ->message(fn (self $notification) => $notification->customMessage) ->form([ \Filament\Forms\Components\TextInput::make('message') ->label('Message') @@ -396,11 +397,11 @@ class TestNotification extends Notification implements AsFilamentNotification ->label('User'), ]) ->constructUsing(function(array $data) { - ['message' => $message, 'user_id_or_something' => $userId] = $data; + ['custom_message' => $message, 'user_id_or_something' => $userId] = $data; return new static( user: User::find($userId), - message: $message + customMessage: $message ); }); } @@ -409,7 +410,7 @@ class TestNotification extends Notification implements AsFilamentNotification { return [ 'user_id_or_something' => $this->user->id, - 'message' => $this->message, + 'custom_message' => $this->message, // Some internal properties are required to store in the database. They will be provided by this method. ...$this->getInternalToArray(), ]; From 5cdcf82d722be4d31119b08bbb697f8a6d3dc034 Mon Sep 17 00:00:00 2001 From: "Ralph J. Smit" <59207045+ralphjsmit@users.noreply.github.com> Date: Thu, 25 Jan 2024 14:23:46 +0100 Subject: [PATCH 4/4] Update activitylog --- content/plugins/ralphjsmit-activitylog-pro.md | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/content/plugins/ralphjsmit-activitylog-pro.md b/content/plugins/ralphjsmit-activitylog-pro.md index 3bacb16d9..390832ddb 100644 --- a/content/plugins/ralphjsmit-activitylog-pro.md +++ b/content/plugins/ralphjsmit-activitylog-pro.md @@ -378,6 +378,28 @@ Timeline::make() ]), ``` +If you are mixing timeline items for multiple Eloquent models and you need access to the current underlying Spatie Activitylog model, you can use the `$arguments['activity_id']` parameter: + +```php +Timeline::make() + ->itemActions('published', [ + Forms\Components\Actions\Action::make('edit') + ->fillForm(function (array $arguments) { + $activity = Activity::find($arguments['activity_id']); + + // ... + }) + ->form([ + Forms\Components\TextInput::make('title') + ]) + ->action(function (array $arguments, array $data) { + $activity = Activity::find($arguments['activity_id']); + + // ... + }) + ]), +``` + ##### Define icons, colors & actions globally If you want to **globally provide icons, colors and actions**, you can make use of the Filament `configureUsing()` method. When working globally with timelines, it is generally very handy to scope the configuration to specific models: