Closed Sergiobop closed 9 months ago
whereOccurresBetween method is bugged atm, since it produces wrong queries. The orWhere should be grouped inside a where clause.
Just use the whereOccurresBetween scope.
The right method should be implemented like this:
public function scopeWhereOccurresBetween(Builder $query, CarbonInterface $start, CarbonInterface $end): Builder { $dates = CarbonPeriod::create( $start, $end, ); $query->where(function (Builder $query) use ($dates) { foreach ($dates as $date) { $query->orWhere(fn ($query) => $query->whereOccurresOn($date)); } }); return $query; }
0.5.1
8.1
10.0
No response
I had to override the scope in my model to make it work.
What happened?
whereOccurresBetween method is bugged atm, since it produces wrong queries. The orWhere should be grouped inside a where clause.
How to reproduce the bug
Just use the whereOccurresBetween scope.
The right method should be implemented like this:
Package Version
0.5.1
PHP Version
8.1
Laravel Version
10.0
Which operating systems does with happen with?
No response
Notes
I had to override the scope in my model to make it work.