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: diff --git a/content/plugins/ralphjsmit-notifications-pro.md b/content/plugins/ralphjsmit-notifications-pro.md index d6993219f..fc41755ec 100644 --- a/content/plugins/ralphjsmit-notifications-pro.md +++ b/content/plugins/ralphjsmit-notifications-pro.md @@ -376,14 +376,17 @@ 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, + 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') @@ -394,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 ); }); } @@ -407,7 +410,9 @@ 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(), ]; } @@ -415,6 +420,8 @@ class TestNotification extends Notification implements AsFilamentNotification { return ['database', 'mail']; } + + // Implement a `toMail()` method to match the methods in `via()`... } ``` @@ -482,7 +489,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 +555,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'), ]); }