32 lines
857 B
PHP
32 lines
857 B
PHP
<?php
|
|
|
|
/**
|
|
* @author Ball Studios <https://git.balls.studio>
|
|
* @license MIT
|
|
*/
|
|
|
|
namespace Pterodactyl\Addons\AdvancedAdmin\Http\Requests\Roles;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateRoleRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user() && $this->user()->root_admin;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => 'sometimes|string|max:100',
|
|
'description' => 'sometimes|nullable|string|max:500',
|
|
'color' => 'sometimes|nullable|string|regex:/^#[0-9a-fA-F]{6}$/',
|
|
'priority' => 'sometimes|integer|min:0|max:9999',
|
|
'is_default' => 'sometimes|boolean',
|
|
'permissions' => 'sometimes|array',
|
|
'permissions.*' => 'in:allow,deny',
|
|
];
|
|
}
|
|
}
|