mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-11 23:19:05 +00:00
22 lines
480 B
PHP
22 lines
480 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UserGroupRequest extends FormRequest
|
|
{
|
|
public function rules(): array
|
|
{
|
|
$unq_name = '';
|
|
if (in_array($this->method(), ['PATCH', 'PUT'], true)) {
|
|
$unq_name = ','.$this->group->id;
|
|
}
|
|
|
|
return [
|
|
'name' => 'required|string|unique:user_group,name'.$unq_name,
|
|
'nodes' => 'nullable|exists:node,id',
|
|
];
|
|
}
|
|
}
|