mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for created_at queryfilter
This commit is contained in:
parent
b1454d11ab
commit
bc1f4bd2f8
@ -15,6 +15,7 @@ namespace App\Filters;
|
|||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class QueryFilters.
|
* Class QueryFilters.
|
||||||
@ -173,22 +174,19 @@ abstract class QueryFilters
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function created_at($value)
|
public function created_at($value = '')
|
||||||
{
|
{
|
||||||
$created_at = $value ? (int) $value : 0;
|
if($value == '')
|
||||||
|
return $this->builder;
|
||||||
$created_at = date('Y-m-d H:i:s', $value);
|
|
||||||
|
|
||||||
if(is_string($created_at)){
|
|
||||||
|
|
||||||
$created_at = strtotime(str_replace("/","-",$created_at));
|
|
||||||
|
|
||||||
if(!$created_at)
|
|
||||||
return $this->builder;
|
|
||||||
|
|
||||||
|
try{
|
||||||
|
$created_at = Carbon::parse($value);
|
||||||
|
return $this->builder->where('created_at', '>=', $created_at);
|
||||||
}
|
}
|
||||||
|
catch(\Exception $e) {
|
||||||
return $this->builder->where('created_at', '>=', $created_at);
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function is_deleted($value)
|
public function is_deleted($value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user