feat(filters): month filters
This commit is contained in:
parent
c2285e66c2
commit
a370db7cc9
1 changed files with 15 additions and 0 deletions
15
app/Filters/FiltersType/MonthFilter.php
Normal file
15
app/Filters/FiltersType/MonthFilter.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filters\FiltersType;
|
||||
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class MonthFilter
|
||||
{
|
||||
function __invoke($query, $month, $value) {
|
||||
$start = Carbon::parse($value)->startOfMonth();
|
||||
$end = Carbon::parse($value)->endOfMonth();
|
||||
|
||||
return $query->whereBetween('starts', [$start, $end]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue