From 49e40f4fb83fde03f16161704a48a6b5272ae280 Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 21 May 2024 23:30:48 +1000 Subject: [PATCH] Generated mail from the hub wont have $model->errors defined --- app/Models/Echomail.php | 2 +- app/Models/Netmail.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/Echomail.php b/app/Models/Echomail.php index bde9025..fe92ef7 100644 --- a/app/Models/Echomail.php +++ b/app/Models/Echomail.php @@ -92,7 +92,7 @@ final class Echomail extends Model implements Packet parent::boot(); static::creating(function($model) { - if ($model->errors->count()) + if (isset($model->errors) && $model->errors->count()) throw new \Exception('Cannot save, validation errors exist'); }); diff --git a/app/Models/Netmail.php b/app/Models/Netmail.php index 1aa1067..acded05 100644 --- a/app/Models/Netmail.php +++ b/app/Models/Netmail.php @@ -86,7 +86,7 @@ final class Netmail extends Model implements Packet parent::boot(); static::creating(function($model) { - if ($model->errors->count()) + if (isset($model->errors) && $model->errors->count()) throw new \Exception('Cannot save, validation errors exist'); });