mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Added support for filtering API lists by updated_at
This commit is contained in:
parent
32bf47aacf
commit
5d00d18601
@ -93,17 +93,19 @@ class BaseAPIController extends Controller
|
|||||||
$includes = $transformer->getDefaultIncludes();
|
$includes = $transformer->getDefaultIncludes();
|
||||||
$includes = $this->getRequestIncludes($includes);
|
$includes = $this->getRequestIncludes($includes);
|
||||||
|
|
||||||
if ($updatedAt = Input::get('updated_at')) {
|
$query->with($includes);
|
||||||
$query->where('updated_at', '>=', $updatedAt);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($includes as $include) {
|
if ($updatedAt = Input::get('updated_at')) {
|
||||||
$query->with([$include => function($query) use ($updatedAt) {
|
$updatedAt = date('Y-m-d H:i:s', $updatedAt);
|
||||||
if ($updatedAt) {
|
$query->where(function($query) use ($includes, $updatedAt) {
|
||||||
$query->where('updated_at', '>=', $updatedAt);
|
$query->where('updated_at', '>=', $updatedAt);
|
||||||
|
foreach ($includes as $include) {
|
||||||
|
$query->orWhereHas($include, function($query) use ($updatedAt) {
|
||||||
|
$query->where('updated_at', '>=', $updatedAt);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}]);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($clientPublicId = Input::get('client_id')) {
|
if ($clientPublicId = Input::get('client_id')) {
|
||||||
$filter = function($query) use ($clientPublicId) {
|
$filter = function($query) use ($clientPublicId) {
|
||||||
@ -167,7 +169,7 @@ class BaseAPIController extends Controller
|
|||||||
if (Utils::isNinjaDev()) {
|
if (Utils::isNinjaDev()) {
|
||||||
$count = count(\DB::getQueryLog());
|
$count = count(\DB::getQueryLog());
|
||||||
Log::info(Request::method() . ' - ' . Request::url() . ": $count queries");
|
Log::info(Request::method() . ' - ' . Request::url() . ": $count queries");
|
||||||
//Log::info(json_encode(\DB::getQueryLog()));
|
Log::info(json_encode(\DB::getQueryLog()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$index = Request::get('index') ?: 'data';
|
$index = Request::get('index') ?: 'data';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user