45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Enums\UserWorkspace\Role as WorkspaceRole;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class StoreWorkspaceInviteRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'email' => ['required', 'email', 'max:255'],
|
|
'role' => ['nullable', Rule::enum(WorkspaceRole::class)],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom messages for validation errors.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'email.required' => 'O email é obrigatório.',
|
|
'email.email' => 'Digite um email válido.',
|
|
'email.max' => 'O email deve ter no máximo 255 caracteres.',
|
|
];
|
|
}
|
|
}
|