Files
backend/app/Http/Requests/V3/Dashboard/UserManagement/ChangeConfirmEnabelRequest.php

33 lines
817 B
PHP

<?php
namespace App\Http\Requests\V3\Dashboard\UserManagement;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class ChangeConfirmEnabelRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
$user = auth()->user();
return $user->hasPermissionTo('full-user-management') ||
($user->hasPermissionTo('limited-user-management') && $this->province_id == $user->province_id);
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array|string>
*/
public function rules(): array
{
return [
'enabled' => 'required|in:0,1',
];
}
}