44 lines
816 B
PHP
44 lines
816 B
PHP
<?php
|
||
|
||
namespace App\Request;
|
||
|
||
use Hyperf\Validation\Request\FormRequest;
|
||
|
||
/**
|
||
* 菜单
|
||
*/
|
||
class Post extends FormRequest
|
||
{
|
||
protected array $scenes = [
|
||
'add' => ['post_name'],
|
||
'edit' => ['post_id', 'post_name'],
|
||
];
|
||
|
||
/**
|
||
* 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 [
|
||
'post_id' => 'required',
|
||
'post_name' => 'required'
|
||
];
|
||
}
|
||
|
||
public function messages(): array
|
||
{
|
||
return [
|
||
'post_id.required' => '岗位ID必填!',
|
||
'post_name.required' => '岗位名称必填!'
|
||
];
|
||
}
|
||
}
|