v2board/app/Http/Requests/Admin/ServerTrojanSave.php

49 lines
1.4 KiB
PHP
Raw Normal View History

2019-10-29 15:33:36 +08:00
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
2020-06-11 20:47:02 +08:00
class ServerTrojanSave extends FormRequest
2019-10-29 15:33:36 +08:00
{
2020-02-10 15:51:01 +08:00
CONST RULES = [
'show' => '',
'name' => 'required',
'group_id' => 'required|array',
2020-07-01 15:23:39 +08:00
'parent_id' => 'nullable|integer',
'host' => 'required',
2020-02-10 15:51:01 +08:00
'port' => 'required',
2020-06-18 20:25:53 +08:00
'server_port' => 'required',
2020-07-01 15:23:39 +08:00
'allow_insecure' => 'nullable|in:0,1',
'server_name' => 'nullable',
2020-03-05 02:30:02 +08:00
'tags' => 'nullable|array',
2020-06-11 20:47:02 +08:00
'rate' => 'required|numeric'
2020-02-10 15:51:01 +08:00
];
2019-10-29 15:33:36 +08:00
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
2020-02-10 15:51:01 +08:00
return self::RULES;
2019-10-29 15:33:36 +08:00
}
2020-01-11 13:36:52 +08:00
2019-10-29 15:33:36 +08:00
public function messages()
{
return [
'name.required' => '节点名称不能为空',
2020-01-11 13:36:52 +08:00
'group_id.required' => '权限组不能为空',
2019-10-29 15:33:36 +08:00
'group_id.array' => '权限组格式不正确',
2020-07-01 15:23:39 +08:00
'parent_id.integer' => '父节点格式不正确',
2019-10-29 15:33:36 +08:00
'host.required' => '节点地址不能为空',
'port.required' => '连接端口不能为空',
2020-06-18 20:25:53 +08:00
'server_port.required' => '后端服务端口不能为空',
2020-07-01 15:23:39 +08:00
'allow_insecure.in' => '允许不安全格式不正确',
2019-10-29 15:33:36 +08:00
'tags.array' => '标签格式不正确',
'rate.required' => '倍率不能为空',
2020-06-11 20:47:02 +08:00
'rate.numeric' => '倍率格式不正确'
2019-10-29 15:33:36 +08:00
];
}
}