From 51dc2b4ed13e7ab873216779154ee2358037735d Mon Sep 17 00:00:00 2001 From: JeuFore <37927640+JeuFore@users.noreply.github.com> Date: Thu, 5 Oct 2023 09:50:20 +0200 Subject: [PATCH] fix: fixed find or fail not found exception --- src/Model.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Model.php b/src/Model.php index 1eaf9dd..8baaf69 100644 --- a/src/Model.php +++ b/src/Model.php @@ -13,6 +13,7 @@ use Ang3\Component\Odoo\Interfaces\ModelInterface; use Illuminate\Support\Collection; use Illuminate\Database\Eloquent\Concerns\HasRelationships; +use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Foundation\Validation\ValidatesRequests; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -273,7 +274,7 @@ public function findOrFail(int $id): self $data = $this->getOneOrNullResult(); if (is_null($data)) - throw new NotFoundHttpException($this->model . ' not found'); + throw (new ModelNotFoundException())->setModel($this->model, $id); return $this->addAttributes($data); }