1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Update BaseAPIController.php

Refactor If blocks.
This commit is contained in:
David Bomba 2018-01-31 13:16:30 +11:00 committed by GitHub
parent 62c018835a
commit df8b896cf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,15 +99,17 @@ class BaseAPIController extends Controller
$query->with($includes);
if ($updatedAt == intval(Input::get('updated_at'))) {
$query->where('updated_at', '>=', date('Y-m-d H:i:s', $updatedAt));
if (Input::get('updated_at') > 0) {
$updatedAt = intval(Input::get('updated_at'));
$query->where('updated_at', '>=', date('Y-m-d H:i:s', $updatedAt));
}
if ($clientPublicId == Input::get('client_id')) {
$filter = function ($query) use ($clientPublicId) {
if (Input::get('client_id') > 0) {
$clientPublicId = Input::get('client_id');
$filter = function ($query) use ($clientPublicId) {
$query->where('public_id', '=', $clientPublicId);
};
$query->whereHas('client', $filter);
};
$query->whereHas('client', $filter);
}
if (! Utils::hasPermission('view_all')) {