This commit is contained in:
Adrian Hopek
2022-03-18 11:00:08 +01:00
parent 140be26159
commit 84fc405314
5 changed files with 3 additions and 47 deletions

View File

@@ -1,22 +0,0 @@
<?php
declare(strict_types=1);
namespace Toby\Eloquent\Scopes;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;
use Toby\Eloquent\Helpers\YearPeriodRetriever;
class SelectedYearPeriodScope implements Scope
{
public function __construct(
protected YearPeriodRetriever $yearPeriodRetriever,
) {}
public function apply(Builder $builder, Model $model): Builder
{
return $builder->where("year_period_id", $this->yearPeriodRetriever->selected()->id);
}
}