mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-11 15:10:54 +00:00
22 lines
485 B
PHP
22 lines
485 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class PermissionRequest extends FormRequest
|
|
{
|
|
public function rules(): array
|
|
{
|
|
$unq_name = '';
|
|
if (in_array($this->method(), ['PATCH', 'PUT'], true)) {
|
|
$unq_name = ','.$this->permission->id;
|
|
}
|
|
|
|
return [
|
|
'name' => 'required|string|unique:permissions,name'.$unq_name,
|
|
'description' => 'required|string',
|
|
];
|
|
}
|
|
}
|