server/app/Request/Post.php

44 lines
816 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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' => '岗位名称必填!'
];
}
}