diff --git a/app/Http/Requests/Common/Contact.php b/app/Http/Requests/Common/Contact.php index 200783ca8..1c93fcb3c 100644 --- a/app/Http/Requests/Common/Contact.php +++ b/app/Http/Requests/Common/Contact.php @@ -31,11 +31,7 @@ class Contact extends FormRequest // Check if store or update if ($this->getMethod() == 'PATCH') { - $model = $type; - - if ($this->isApi()) { - $model = 'contact'; - } + $model = $this->isApi() ? 'contact' : $type; $id = is_numeric($this->$model) ? $this->$model : $this->$model->getAttribute('id'); } else { diff --git a/app/Http/Requests/Document/Document.php b/app/Http/Requests/Document/Document.php index ded651f33..e04e8706c 100644 --- a/app/Http/Requests/Document/Document.php +++ b/app/Http/Requests/Document/Document.php @@ -32,11 +32,7 @@ class Document extends FormRequest // Check if store or update if ($this->getMethod() == 'PATCH') { - $model = $type; - - if ($this->isApi()) { - $model = 'document'; - } + $model = $this->isApi() ? 'document' : $type; $id = is_numeric($this->$model) ? $this->$model : $this->{$model}->getAttribute('id'); } else {