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.