-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database Notifications - Customizable "Mark All as Read" Action #14157
base: 4.x
Are you sure you want to change the base?
Database Notifications - Customizable "Mark All as Read" Action #14157
Conversation
…) method, which allows customization of the Mark All as Read action within the database notifications modal.
If this is approved, I can also submit the Clear Notifications actions. |
@@ -28,6 +29,8 @@ class DatabaseNotifications extends Component | |||
|
|||
public static ?string $authGuard = null; | |||
|
|||
public static ?Action $markAllNotificationsAsReadAction = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of storing the action, please add HasActions
and InteractsWithActions
to this component, and then rename getMarkAllNotificationsAsReadAction
to markAllNotificationsAsReadAction
. Then you can use $this->markAllNotificationsAsReadAction
to render
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You won't need this line anymore
packages/notifications/resources/views/database-notifications.blade.php
Outdated
Show resolved
Hide resolved
if ($action = static::$markAllNotificationsAsReadAction) { | ||
return $action; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this
@leandrocfe please check my remaining comments |
@danharrin did you see my answers? |
I don't see any responses, sorry |
Hey @danharrin, I fixed it implementing But I think we need this if ($action = static::$markAllNotificationsAsReadAction) {
return $action;
} Because when we are using Notifications in standalone mode, we can do this in the provider: public function boot(): void
{
DatabaseNotifications::trigger('notifications-trigger');
DatabaseNotifications::$markAllNotificationsAsReadAction = Action::make('markAllNotificationsAsRead')
->label('Mark all as read')
->button()
->action('markAllNotificationsAsRead');
} Does it make sense? |
Description
This feature introduces the
databaseNotificationsMarkAllAsReadAction()
method, which allows passing a closure that returns a custom action. It enables full customization of the Mark All as Read button using the same methods available for customizing trigger buttons.Visual changes
Functional changes
composer cs
command.