mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2026-03-03 02:47:02 +00:00
Add created between filter
This commit is contained in:
@@ -338,6 +338,33 @@ abstract class QueryFilters
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Filter by created at date range
|
||||
*
|
||||
* @param string $date_range
|
||||
* @return Builder
|
||||
*/
|
||||
public function created_between(string $date_range = ''): Builder
|
||||
{
|
||||
$parts = explode(",", $date_range);
|
||||
|
||||
if (count($parts) != 2 || !in_array('created_at', \Illuminate\Support\Facades\Schema::getColumnListing($this->builder->getModel()->getTable()))) {
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
$start_date = Carbon::parse($parts[0]);
|
||||
$end_date = Carbon::parse($parts[1]);
|
||||
|
||||
return $this->builder->whereBetween('created_at', [$start_date, $end_date]);
|
||||
} catch (\Exception $e) {
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter by date range
|
||||
*
|
||||
|
||||
@@ -145,7 +145,9 @@ return [
|
||||
'gocardless' => [
|
||||
'client_id' => env('GOCARDLESS_CLIENT_ID', null),
|
||||
'client_secret' => env('GOCARDLESS_CLIENT_SECRET', null),
|
||||
'debug' => env('APP_DEBUG',false)
|
||||
'debug' => env('APP_DEBUG',false),
|
||||
'redirect_uri' => env('GOCARDLESS_REDIRECT_URI', null),
|
||||
'environment' => env('GOCARDLESS_ENVIRONMENT', 'production'),
|
||||
],
|
||||
'quickbooks_webhook' => [
|
||||
'verifier_token' => env('QUICKBOOKS_VERIFIER_TOKEN', false),
|
||||
|
||||
Reference in New Issue
Block a user