hospital-applets-api/app/Request/BasicDataRequest.php
2023-02-17 17:10:16 +08:00

50 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Request;
use App\Constants\HttpEnumCode;
use Hyperf\Validation\Request\FormRequest;
class BasicDataRequest extends FormRequest
{
protected array $scenes = [
'getHospital' => [ // 获取医院数据
'province_id',
'city_id',
'county_id',
],
];
/**
* 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 [
'province_id' => 'required_with:city_id,county_id',
'city_id' => 'required_with:county_id',
];
}
/**
* 获取已定义验证规则的错误消息.
*/
public function messages(): array
{
return [
'province_id.required_with' => "请选择省份",
'city_id.required_with' => "请选择城市",
];
}
}