#63 - permissions

This commit is contained in:
Adrian Hopek
2022-03-01 14:49:09 +01:00
parent c9a7ec4869
commit b81b0f857c
21 changed files with 419 additions and 181 deletions

View File

@@ -27,16 +27,29 @@ class VacationRequestRequest extends FormRequest
public function data(): array
{
$from = $this->get("from");
return [
"user_id" => $this->get("user"),
"type" => $this->get("type"),
"from" => $from,
"from" => $this->get("from"),
"to" => $this->get("to"),
"year_period_id" => YearPeriod::findByYear(Carbon::create($from)->year)->id,
"year_period_id" => $this->yearPeriod()->id,
"comment" => $this->get("comment"),
"flow_skipped" => $this->boolean("flowSkipped"),
];
}
public function yearPeriod(): YearPeriod
{
return YearPeriod::findByYear(Carbon::create($this->get("from"))->year);
}
public function createsOnBehalfOfEmployee(): bool
{
return $this->user()->id !== $this->get("user");
}
public function wantsSkipFlow(): bool
{
return $this->boolean("flowSkipped");
}
}