#23 - ecs fix
This commit is contained in:
@@ -48,4 +48,4 @@ class YearPeriodRetriever
|
||||
"link" => route("year-periods.select", $yearPeriod->id),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,8 +11,9 @@ use Toby\Http\Resources\UserResource;
|
||||
|
||||
class HandleInertiaRequests extends Middleware
|
||||
{
|
||||
public function __construct(protected YearPeriodRetriever $yearPeriodRetriever)
|
||||
{
|
||||
public function __construct(
|
||||
protected YearPeriodRetriever $yearPeriodRetriever,
|
||||
) {
|
||||
}
|
||||
|
||||
public function share(Request $request): array
|
||||
|
@@ -20,7 +20,6 @@ class VacationLimitRequest extends FormRequest
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function vacationLimits(): Collection
|
||||
{
|
||||
return VacationLimit::query()->find($this->collect("items")->pluck("id"));
|
||||
@@ -32,7 +31,7 @@ class VacationLimitRequest extends FormRequest
|
||||
$item["id"] => [
|
||||
"has_vacation" => $item["hasVacation"],
|
||||
"days" => $item["days"],
|
||||
]
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -21,7 +21,9 @@ class UserObserver
|
||||
{
|
||||
$user->saveAvatar($this->generator->generateFor($user));
|
||||
|
||||
$user->vacationLimits()->create(["year_period_id" => $this->yearPeriodRetriever->current()->id]);
|
||||
$user->vacationLimits()->create([
|
||||
"year_period_id" => $this->yearPeriodRetriever->current()->id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function updating(User $user): void
|
||||
|
@@ -20,7 +20,9 @@ class YearPeriodObserver
|
||||
$users = User::all();
|
||||
|
||||
foreach ($users as $user) {
|
||||
$yearPeriod->vacationLimits()->updateOrCreate(["user_id" => $user->id]);
|
||||
$yearPeriod->vacationLimits()->updateOrCreate([
|
||||
"user_id" => $user->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,12 +11,13 @@ use Toby\Helpers\YearPeriodRetriever;
|
||||
|
||||
class SelectedYearPeriodScope implements Scope
|
||||
{
|
||||
public function __construct(protected YearPeriodRetriever $yearPeriodRetriever)
|
||||
{
|
||||
public function __construct(
|
||||
protected YearPeriodRetriever $yearPeriodRetriever,
|
||||
) {
|
||||
}
|
||||
|
||||
public function apply(Builder $builder, Model $model): Builder
|
||||
{
|
||||
return $builder->where("year_period_id", $this->yearPeriodRetriever->selected()->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user