mirror of
https://gitee.com/ctexthuang/hyperf_rbac_framework_server_ctexthuang.git
synced 2025-12-25 15:57:50 +08:00
fix : update path And request
This commit is contained in:
81
app/Request/Admin/AdminUserRequest.php
Normal file
81
app/Request/Admin/AdminUserRequest.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Request\Admin;
|
||||
|
||||
use Hyperf\Validation\Request\FormRequest;
|
||||
|
||||
class AdminUserRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'username' => 'required|string|max:20',
|
||||
'user_type' => 'required|integer',
|
||||
'nickname' => ['required', 'string', 'max:60', 'regex:/^[^\s]+$/'],
|
||||
'phone' => 'sometimes|string|max:12',
|
||||
'email' => 'sometimes|string|max:60|email:rfc,dns',
|
||||
'avatar' => 'sometimes|string|max:255|url',
|
||||
'signed' => 'sometimes|string|max:255',
|
||||
'status' => 'sometimes|integer',
|
||||
'backend_setting' => 'sometimes|array|max:255',
|
||||
'remark' => 'sometimes|string|max:255',
|
||||
'password' => 'sometimes|string|min:6|max:20',
|
||||
'role_codes' => 'required|array',
|
||||
'role_codes.*' => 'string|exists:role,code',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return parent::messages();
|
||||
}
|
||||
|
||||
protected array $scenes = [
|
||||
'update' => [
|
||||
'username',
|
||||
'user_type',
|
||||
'nickname',
|
||||
'phone',
|
||||
'email',
|
||||
'avatar',
|
||||
'signed',
|
||||
'status',
|
||||
'backend_setting',
|
||||
'remark',
|
||||
'password',
|
||||
],
|
||||
'create' => [
|
||||
'username',
|
||||
'user_type',
|
||||
'nickname',
|
||||
'phone',
|
||||
'email',
|
||||
'avatar',
|
||||
'signed',
|
||||
'status',
|
||||
'backend_setting',
|
||||
'remark',
|
||||
'password',
|
||||
],
|
||||
'batch_grant_role' => [
|
||||
'role_codes',
|
||||
'role_codes.*',
|
||||
]
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user