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

53 lines
1.6 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;
class ServerSave extends FormRequest
{
2020-02-10 15:51:01 +08:00
CONST RULES = [
2020-02-10 18:48:06 +08:00
'rules' => '',
2020-02-10 15:51:01 +08:00
'show' => '',
'name' => 'required',
'group_id' => 'required|array',
'parent_id' => 'nullable|integer',
'host' => 'required',
'port' => 'required',
'server_port' => 'required',
'tls' => 'required',
'tags' => 'array',
'rate' => 'required|numeric',
2020-02-10 18:54:17 +08:00
'network' => 'required|in:tcp,kcp,ws,http,domainsocket,quic',
'settings' => ''
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' => '权限组格式不正确',
2019-12-29 13:21:36 +08:00
'parent_id.integer' => '父ID格式不正确',
2019-10-29 15:33:36 +08:00
'host.required' => '节点地址不能为空',
'port.required' => '连接端口不能为空',
'server_port.required' => '后端服务端口不能为空',
'tls.required' => 'TLS不能为空',
'tags.array' => '标签格式不正确',
'rate.required' => '倍率不能为空',
2019-11-06 00:53:02 +08:00
'rate.numeric' => '倍率格式不正确',
'network.required' => '传输协议不能为空',
2019-11-06 00:59:49 +08:00
'network.in' => '传输协议格式不正确'
2019-10-29 15:33:36 +08:00
];
}
}