Open RehamTammam1 opened 2 months ago
Hello Reham,
Thank you for providing all the details!
Could you please try registering the \Flasher\Laravel\Middleware\FlasherMiddleware::class
middleware in your application? You can add it to the $middleware
array in the app/Http/Kernel.php
file like this:
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array<int, class-string|string>
*/
protected $middleware = [
// Other middleware...
\Flasher\Laravel\Middleware\FlasherMiddleware::class,
];
// Other properties and methods...
}
This should ensure that the middleware is properly registered and can handle the flash notifications.
If adding the middleware doesn't resolve the issue, please share a project on GitHub where you can reproduce the issue, and I'd be glad to help you fix it.
Looking forward to your feedback!
Best regards,
Younes
Hello @yoeunes,
Thank you for your guidance—it worked perfectly for me! After registering the middleware in kernel.php, the notifications populated successfully. I believe it would greatly enhance user experience if this step or a note about it could be added as part of the installation/configuration steps. It would save users a lot of time.
However, I'm facing another issue where the notification is triggered with each page refresh, even in cases where it shouldn't be. Do you have any recommendations on how to address this issue?
Thanks in advance!
Hi Reham,
Thanks for the feedback! You’re absolutely right about documenting that step, and I’ll definitely add it when I get the chance. If you’re open to it, it would be awesome if you could contribute by adding this note to the documentation as well.
Regarding the notifications being triggered on each page refresh, it sounds like it might be similar to another issue we’ve seen. Could you take a look at this comment and see if it helps: php-flasher/php-flasher#188 (comment)?
Feel free to reach out if anything else comes up!
Hello, I'm using Laravel 11.9 and following the instructions to integrate Toastr notifications with the Flasher package in my application. However, the notifications are not displaying as expected. Problem: After saving a new grade, I expect a Toastr notification to appear confirming that the data was saved successfully. However, no notifications are displayed. Expected Behavior: A Toastr notification should display a success message when the grade is successfully saved.
Actual Behavior: No notifications are displayed, even though the session data contains the notification information.
Additional Information:
Laravel Version: 11.9 PHP Version: 8.2 Flasher Package: php-flasher/flasher-toastr Could you please assist in identifying why the Toastr notifications aren't displaying?
Thank you!