Custom DatabaseNotification class
Hi. I need to use a custom DatabaseNotification class instead of this: https://github.com/filamentphp/filament/blob/3.x/packages/notifications/src/DatabaseNotification.php.
I've tried extending the
I've tried extending the
Filament\Notifications\Notification
class and overriding the toDatabase
method but it's return typed, which makes it difficult:
Any ideas on how to work around this? Alternatively I'm wondering if I should submit a PR to remove the typing.8 Replies
If you read it... you haven't made it compatible. I.e. each function being used must mirror it from the construction point.
I suspect you are missing the params of the function
you have to call databasenotification in AdminPanelProvider
and create the notification function on the resource creation page
It's not compatible because I'm using a custom class instead of
Filament\Notifications\DatabaseNotification
. That's my point- the method is return typed to Filament\Notifications\DatabaseNotification
which makes overriding it difficult. I need to use my own class because I'm using custom schema-based tenancy. And a custom database notification channel to make notifications tenant-aware.use Filament\Notifications\Notification;
I am. That's not the issue.
protected function getCreatedNotification(): ?Notification
All good. Submitted a PR- will see what the maintainers say on GitHub.
ok