feat(admin): 完善后台角色管理与权限同步,新增当前管理员信息接口
This commit is contained in:
26
app/Http/Requests/Admin/AdminRoleUpdateRequest.php
Normal file
26
app/Http/Requests/Admin/AdminRoleUpdateRequest.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
final class AdminRoleUpdateRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$roleId = $this->route('admin_role')?->id;
|
||||
|
||||
return [
|
||||
'slug' => ['sometimes', 'string', 'max:64', 'regex:/^[a-z0-9_\\-]+$/', Rule::unique('admin_roles', 'slug')->ignore($roleId)],
|
||||
'name' => ['sometimes', 'string', 'max:128'],
|
||||
'description' => ['nullable', 'string', 'max:65535'],
|
||||
'status' => ['sometimes', 'integer', 'in:0,1'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user