how can i use php flusher and it's features such has sweetalert, toast from blade ? #204
Replies: 1 comment
-
Hello @md-nobir-hasan! To answer your question, you don’t need to modify your Blade templates to use PHPFlasher. PHPFlasher is designed to send notifications directly from your backend controllers. It automatically injects the necessary scripts and displays the notifications on the frontend using the default configuration. Here’s how you can use it:
Simply add a flash message like this in your controller method: use Flasher\SweetAlert\Prime\SweetAlertFactory;
public function yourFunction(SweetAlertFactory $flasher)
{
// Your logic here
$flasher->success('Your success message here');
return redirect()->back();
} This will queue the notification, and upon redirecting, PHPFlasher will handle displaying it.
Since PHPFlasher automatically injects the necessary scripts and handles the display of notifications, you don’t need to add anything to your Blade files.
Ensure you’re using the default configuration, which allows PHPFlasher to work out-of-the-box without additional setup on the frontend. If you need to customize the notifications further or have any other questions, feel free to ask. |
Beta Was this translation helpful? Give feedback.
-
is:open category:Q&A I install php flasher and sweet alert. now how can i use them from blade ? pleae, reply fast because my project has deadline. thanks.
Beta Was this translation helpful? Give feedback.
All reactions