#63 - permissions (#67)

* wip

* fix

* wip

* #63 - permissions

Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl>
This commit is contained in:
Adrian Hopek
2022-03-02 09:52:50 +01:00
committed by GitHub
parent 5cb46d2fc4
commit d825dd727f
47 changed files with 1027 additions and 411 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");
}
}