36 lines
950 B
PHP
36 lines
950 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
use App\Concerns\ProfileValidationRules;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rules\Password;
|
|
|
|
class UpdateManagedUserRequest extends FormRequest
|
|
{
|
|
use ProfileValidationRules;
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user()?->can('access-admin') ?? false;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
...$this->profileRules($this->route('user')?->id),
|
|
'must_change_password_on_next_login' => ['required', 'boolean'],
|
|
'password' => ['nullable', 'string', Password::default(), 'confirmed'],
|
|
];
|
|
}
|
|
}
|