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; <?php namespace App\Http\Controllers;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Utils; use Utils;
use Response; use Response;
use Input; use Input;
@ -134,10 +135,12 @@ class ClientApiController extends BaseAPIController
public function update(UpdateClientRequest $request, $publicId) public function update(UpdateClientRequest $request, $publicId)
{ {
if ($request->action == ACTION_ARCHIVE) { if ($request->action == ACTION_ARCHIVE) {
$client = Client::scope($publicId)->withTrashed()->first();
if(!$client) try {
return $this->errorResponse(['message'=>'Client not found.']); $client = Client::scope($publicId)->withTrashed()->firstOrFail();
} catch (ModelNotFoundException $e) {
return $this->errorResponse(['message'=>'Record not found'], 400);
}
$this->clientRepo->archive($client); $this->clientRepo->archive($client);