Skip to content

Commit

Permalink
Update Filterable.php
Browse files Browse the repository at this point in the history
  • Loading branch information
sedehi authored Feb 3, 2018
1 parent 03c758d commit 408beeb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Filterable.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ private function mktime(){
}
}

private function convertDate($date){
private function convertDate($date, $last = false){

$mktimeFunction = $this->mktime();
$dateTime = [];
$dateTime[3] = '0';
$dateTime[4] = '0';
$dateTime[5] = '0';
$dateTime[3] = ($last) ? '23' : '0';
$dateTime[4] = ($last) ? '59' : '0';
$dateTime[5] = ($last) ? '59' : '0';
$dateTime = array_merge(explode(config('filterable.date_divider'), $date), $dateTime);
$formats = ['d' => 0, 'm' => 1, 'y' => 2, 'h' => 3, 'i' => 4, 's' => 5];
if(count($dateTime) == 6) {
Expand Down Expand Up @@ -131,7 +131,7 @@ private function clauseBetween($query, $key, $value){
foreach($value['between'] as $vBetween) {
if(request()->has($vBetween) && !is_null(request($vBetween))) {
if(in_array($key, $dates)) {
$betweenValue[] = $this->convertDate(request()->get($vBetween));
$betweenValue[] = $this->convertDate(request()->get($vBetween), (last($value['between']) == $vBetween) ? true : false);
}else {
$betweenValue[] = request()->get($vBetween);
}
Expand Down

0 comments on commit 408beeb

Please sign in to comment.