Adding back change from conflict

This commit is contained in:
Hillel Coren 2016-02-17 00:07:05 +02:00
parent 2de09d9835
commit 2295102b98

View File

@ -1,5 +1,6 @@
<?php namespace App\Http\Controllers;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Utils;
use Response;
use Input;
@ -134,10 +135,12 @@ class ClientApiController extends BaseAPIController
public function update(UpdateClientRequest $request, $publicId)
{
if ($request->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);