diff --git a/app/Models/WorkOrder/Reply.php b/app/Models/WorkOrder/Reply.php index 7da6cb6..bef9f8c 100644 --- a/app/Models/WorkOrder/Reply.php +++ b/app/Models/WorkOrder/Reply.php @@ -76,6 +76,10 @@ protected static function boot() // load work order $model->load(['workOrder']); + // throw if work order is null + if (is_null($model->workOrder)) { + throw new CommonException('Work order not found'); + } throw_if($model->workOrder->status == 'pending' || $model->workOrder->status == 'error', CommonException::class, '工单状态不正确'); // change work order status