changes for the controller have been withdrawn

Co-authored-by: Adrian Hopek <adrian.hopek@blumilk.pl>
This commit is contained in:
2022-06-07 12:37:07 +02:00
parent 2be881381d
commit ba1d5bce2a
2 changed files with 3 additions and 42 deletions

View File

@@ -1,36 +0,0 @@
<?php
declare(strict_types=1);
namespace Toby\Infrastructure\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Toby\Eloquent\Models\VacationRequest;
class CreateVacationRequestRequest extends FormRequest
{
protected $redirectRoute = "vacation.requests.create";
public function authorize(): bool
{
return ($this->get("user") === null) ||
((int)$this->get("user") === $this->user()->id) ||
$this->user()->can("createOnBehalfOfEmployee", VacationRequest::class);
}
public function rules(): array
{
return [
"user" => ["nullable", "exists:users,id"],
"from_date" => ["nullable", "date_format:Y-m-d"],
];
}
public function data(): array
{
return [
"user" => (int)$this->get("user"),
"from_date" => $this->get("from_date"),
];
}
}