Filament noti in livewire component

I'm trying to send a filament notification in a Livewire component when a user creates a post, redirects to the home page, and displays the notification on the home page. How can I? Can I dispatch event or sth?
13 Replies
Shaung Bhone
Shaung BhoneOP12mo ago
.
Shaung Bhone
Shaung BhoneOP12mo ago
Yes
Dennis Koch
Dennis Koch12mo ago
So what did you try and where are you stuck?
Shaung Bhone
Shaung BhoneOP12mo ago
I mean user creates a post and redirects to another route and I want to see a filament notification in this route.
Dennis Koch
Dennis Koch12mo ago
I understand what you mean. But where is your issue?
Shaung Bhone
Shaung BhoneOP12mo ago
There is no issue. I don't know what to do this!
Dennis Koch
Dennis Koch12mo ago
I need a little bit of work on your side, as the docs explain how to set up and send notificaitons. Where are you stuck? Sending the notification? Displaying them? Redirecting? Sending a notification when a user is created?
Shaung Bhone
Shaung BhoneOP12mo ago
public function submit()
{
//
$this->form->model($record)->saveRelationships();

$this->form->fill();

return redirect('/');

Notification::make()
->title('Saved successfully')
->success()
->send();
}
public function submit()
{
//
$this->form->model($record)->saveRelationships();

$this->form->fill();

return redirect('/');

Notification::make()
->title('Saved successfully')
->success()
->send();
}
I want to see notification in home page. That's code is not worked.
Dennis Koch
Dennis Koch12mo ago
Home page is a non Filament page? Did you embed the scripts as mentioned in the docs? https://filamentphp.com/docs/3.x/notifications/installation#configuring-your-layout
Shaung Bhone
Shaung BhoneOP12mo ago
Yes I've already set that
Dennis Koch
Dennis Koch12mo ago
Um, you return from the method before sending the notification. The notification code is never executed.
return redirect('/');

Notification::make()
return redirect('/');

Notification::make()
Shaung Bhone
Shaung BhoneOP12mo ago
Yes Let me check again
Want results from more Discord servers?
Add your server