
* #2 - wip * #2 - wip * #2 - ui fixes to login page * #2 - fix * #2 - fix * #4- wip * #4 - wip * #4 - wip * #4 - wip * #4- wip * #4 - wip * #4 - wip * #4 - tests * #4 - ecs fix * #4 - fix * #4 - wip * #4 - fix * #4 - fix * #4 - fix composer * #4 - cr fix Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl>
34 lines
903 B
PHP
34 lines
903 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Toby\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
use Illuminate\Validation\Rules\Enum;
|
|
use Toby\Enums\EmploymentForm;
|
|
|
|
class UserRequest extends FormRequest
|
|
{
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
"name" => ["required", "min:3", "max: 150"],
|
|
"email" => ["required", "email", Rule::unique("users", "email")->ignore($this->user)],
|
|
"employmentForm" => ["required", new Enum(EmploymentForm::class)],
|
|
"employmentDate" => ["required", "date"],
|
|
];
|
|
}
|
|
|
|
public function data(): array
|
|
{
|
|
return [
|
|
"name" => $this->get("name"),
|
|
"email" => $this->get("email"),
|
|
"employment_form" => $this->get("employmentForm"),
|
|
"employment_date" => $this->get("employmentDate"),
|
|
];
|
|
}
|
|
}
|