Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| UpdateUserRequest | |
0.00% |
0 / 9 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| authorize | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| rules | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Requests; |
| 4 | |
| 5 | use Illuminate\Foundation\Http\FormRequest; |
| 6 | use Illuminate\Validation\Rule; |
| 7 | |
| 8 | class UpdateUserRequest extends FormRequest |
| 9 | { |
| 10 | /** |
| 11 | * Determine if the user is authorized to make this request. |
| 12 | */ |
| 13 | public function authorize(): bool |
| 14 | { |
| 15 | return true; |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Get the validation rules that apply to the request. |
| 20 | * |
| 21 | * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string> |
| 22 | */ |
| 23 | public function rules(): array |
| 24 | { |
| 25 | $userId = $this->route('id') ?? $this->user()->id; |
| 26 | |
| 27 | return [ |
| 28 | 'name' => ['sometimes', 'required', 'string', 'max:255'], |
| 29 | 'given_name' => ['nullable', 'string', 'max:255'], |
| 30 | 'family_name' => ['nullable', 'string', 'max:255'], |
| 31 | 'email' => ['sometimes', 'required', 'string', 'email', 'max:255', Rule::unique('users')->ignore($userId)], |
| 32 | 'status' => ['nullable', 'string', 'in:active,suspended,banned'], |
| 33 | ]; |
| 34 | } |
| 35 | } |