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); }