In laravel 10 / filamentphp 3 app when user completes some action on frontend Notification is send to any manager :
class UserQuizRequestCompletedByJobSeekerEventListener
{
protected GetUserQuizRequestContentInterface $getUserQuizRequestContentInterface;
/**
* Create the event listener.
*
* @return void
*/
public function __construct(GetUserQuizRequestContentInterface $getUserQuizRequestContentInterface)
{
$this->getUserQuizRequestContentInterface = $getUserQuizRequestContentInterface;
}
public function handle(UserQuizRequestCompletedByJobSeekerEvent $UserQuizRequestCompletedByJobSeekerEvent)
{
$userQuizRequest = $UserQuizRequestCompletedByJobSeekerEvent->userQuizRequest;
$getNotificationContentFromFeedback = app(GetUserQuizRequestAsCompletedByUserContentInterface::class);
$managers = Manager::get();
foreach ($managers as $manager) {
Notification::send($manager, new UserQuizRequestCompletedByJobSeekerEventNotification(
userQuizRequest: $userQuizRequest,
manager: $manager->toArray()
));
$content = $getNotificationContentFromFeedback->get(
userQuizRequest: $userQuizRequest,
manager: $manager->toArray(),
valuesArray: [],
phpEolLineBreaker: true
);
$tempUser = User::factory()->make([
'id' => $manager->id,
'name' => $manager->name,
'email' => $manager->email,
]);
FilamentNotificationsNotification::make() // Notification is send to any manager
->title('Quiz completed by user')
->body($content)
->info()
->sendToDatabase(users: [$tempUser]);
}
}
}
Sent Notification holds inside info about action and link inside of dashboard part how to open the form. In db field data of notifications table I see :
{"actions":[],"body":"Hi manager name, n job seeker Alf Cronin at "Quizzes" site run "HTML category" quiz "nCheck Dashboard by url <a href="http://local-quizzes.com/app/service-owner/user-quiz-requests/39/edit"> Editor Reference </a>! nn. You have received this email as you are manager of "Quizzes" nnBest Regards,<br> Support of Quizzes Team","color":null,"duration":"persistent","icon":"heroicon-o-information-circle","iconColor":"info","status":"info","title":"Quiz completed by user","view":"filament-notifications::notification","viewData":[],"format":"filament"}
This href link to the form and I see this notification in right top area of new notifications and that woks ok, but
when manager click of this link this notification is still in right top area – as manager clicked on href link, but not on “close”
icon. If there is a way to fix it – so when manager click of this link – the notification would diseapper from notifications?
5