Clarify error if client not found

This commit is contained in:
Hillel Coren 2018-06-17 12:56:44 +03:00
parent 50e13378f0
commit 4362fd182a

View File

@ -181,7 +181,11 @@ class InvoiceApiController extends BaseAPIController
$client = $this->clientRepo->save($clientData);
}
} elseif (isset($data['client_id'])) {
$client = Client::scope($data['client_id'])->firstOrFail();
$client = Client::scope($data['client_id'])->first();
if (! $client) {
return $this->errorResponse('Client not found', 404);
}
}
$data = self::prepareData($data, $client);