Maybe its gets run between a foreach loop?
Notification displaying multiple times.
I am using Laravel 9 and Filament. I have a Resource class called "ProductResource" for products. The "table" function in the "ProductResource" class displays all the products in the database with predefined actions such as "View, Edit, Delete". I have created a custom action class to add products to a cart. In this custom action class, I redirect the user to another page using the "url" method, but I want to execute a condition before the redirection. Here is a part of the code for the custom action class :
$this->url(function (Product $record) { if ($record->stock == 0) { $this->failure(); return route('filament.resources.products.index'); }else{ return route('filament.pages.product-to-add', ['record' => $record]); } }); $this->failureNotificationTitle(__('Product out of stock'));
The notification "this failure" displays 3 times every time the page is loaded, despite the condition. I don't know why.
Please or to participate in this conversation.