Add user management endpoints and link employees to existing users through `user_id`, including API resources, validation, repository support, and database migrations. Introduce a two-step login flow that checks email first and lets users without a password create one before signing in. Update the employee detail UI with a dedicated user tab and refresh the employee and intervention side navigation to support the new account management flow.
36 lines
845 B
PHP
36 lines
845 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
use Illuminate\Validation\Rules\Password;
|
|
|
|
class UpdateUserRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<int, mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => ['required', 'string', 'max:255'],
|
|
'email' => [
|
|
'required',
|
|
'string',
|
|
'email',
|
|
'max:255',
|
|
Rule::unique('users', 'email')->ignore($this->route('user')),
|
|
],
|
|
'password' => ['nullable', 'string', Password::min(8)],
|
|
];
|
|
}
|
|
}
|