From 2295102b98f13599adaee334e6778b9cf32c3fbd Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 17 Feb 2016 00:07:05 +0200 Subject: [PATCH] Adding back change from conflict --- app/Http/Controllers/ClientApiController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/ClientApiController.php b/app/Http/Controllers/ClientApiController.php index aa5c2fa6bfd4..a3fea1435fb4 100644 --- a/app/Http/Controllers/ClientApiController.php +++ b/app/Http/Controllers/ClientApiController.php @@ -1,5 +1,6 @@ action == ACTION_ARCHIVE) { - $client = Client::scope($publicId)->withTrashed()->first(); - if(!$client) - return $this->errorResponse(['message'=>'Client not found.']); + try { + $client = Client::scope($publicId)->withTrashed()->firstOrFail(); + } catch (ModelNotFoundException $e) { + return $this->errorResponse(['message'=>'Record not found'], 400); + } $this->clientRepo->archive($client);