Adding back change from conflict
This commit is contained in:
parent
2de09d9835
commit
2295102b98
1 changed files with 6 additions and 3 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue