F
Filament11mo ago
Nathan

How to handle Error in beforeReplicaSaved

I need to sync with an external API when a new product is created. How can i return an error and stop the replication in the beforeReplicaSaved method if the API call failed? I tried:
Notification::make()
->title('Error')
->body('Item not duplicated')
->send();

$this->redirect(ProductResource::getUrl('view', ['record' => $record]));
Notification::make()
->title('Error')
->body('Item not duplicated')
->send();

$this->redirect(ProductResource::getUrl('view', ['record' => $record]));
But this resulted in 2 messages one error and one success.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server