Level 1
There is no whereInYear() query builder, you can use whereIn('year', $years) or create a dynamic scopeInYear()
public function scopeInYear($query, $years)
{
return $query->whereIn('year', $years);
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
in my query I am able to do
whereYear()
but i need something like
whereInYear()
how would you do it?
this seems to be working....
$query->whereIn( \DB::raw('year(birthday)'), request()->year );
Please or to participate in this conversation.