Dual display of notifications
I am fulfilling a validation before updating a record, if the condition on an allowed restriction, an error is displayed and the record is not updated.
I'm doing this in beforeSave(), the record does not actually update but I have a duplicate notification, the expected error and the project's default success.
Does anyone know how to treat this?
Code:
protected function beforeSave()
{
if(isset($this->record->status) && $this->record->status == 'In production') {
$noworking = new WorkingDays();
$check = $noworking->noWorking($this->record->wait_date_at);
if($check) {
// return error
return Notification::make()
->title('OPS!')
->body('Error')
->danger()
->seconds(10)
->send();
}
}
}
I'm doing this in beforeSave(), the record does not actually update but I have a duplicate notification, the expected error and the project's default success.
Does anyone know how to treat this?
Code:
protected function beforeSave()
{
if(isset($this->record->status) && $this->record->status == 'In production') {
$noworking = new WorkingDays();
$check = $noworking->noWorking($this->record->wait_date_at);
if($check) {
// return error
return Notification::make()
->title('OPS!')
->body('Error')
->danger()
->seconds(10)
->send();
}
}
}
