<?php

namespace App\Http\Requests\User;

use Illuminate\Foundation\Http\FormRequest;

class DeleteUser extends FormRequest
{
    public function prepareForValidation(): void
    {
        $this->merge(['id' => $this->route('user')->id]);
    }

    public function rules(): array
    {
        return [
            'id' => 'required|exists:users',
        ];
    }

    public function authorize(): bool
    {
        return hasRole('admin');
    }
}
