-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from heseya/feature/MPT-2755-8-0-0
Added updated from and to filters to orders
- Loading branch information
Showing
6 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace App\Criteria; | ||
|
||
use Heseya\Searchable\Criteria\Criterion; | ||
use Illuminate\Database\Eloquent\Builder; | ||
|
||
class WhereUpdatedAfter extends Criterion | ||
{ | ||
public function query(Builder $query): Builder | ||
{ | ||
return $query->where('updated_at', '>=', $this->value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Criteria; | ||
|
||
use Heseya\Searchable\Criteria\Criterion; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Illuminate\Support\Str; | ||
|
||
class WhereUpdatedBefore extends Criterion | ||
{ | ||
public function query(Builder $query): Builder | ||
{ | ||
if (!Str::contains($this->value, ':')) { | ||
$this->value = Str::before($this->value, 'T') . 'T23:59:59'; | ||
} | ||
|
||
return $query->where('updated_at', '<=', $this->value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters