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

55 lines
1.7 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 ServerV2raySave extends FormRequest
2019-10-29 15:33:36 +08:00
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
2020-07-15 15:57:12 +08:00
return [
'show' => '',
'name' => 'required',
'group_id' => 'required|array',
'parent_id' => 'nullable|integer',
'host' => 'required',
'port' => 'required',
'server_port' => 'required',
'tls' => 'required',
'tags' => 'nullable|array',
'rate' => 'required|numeric',
2020-11-17 22:12:51 +08:00
'alter_id' => 'required|integer',
2020-07-15 15:57:12 +08:00
'network' => 'required|in:tcp,kcp,ws,http,domainsocket,quic',
'networkSettings' => '',
'ruleSettings' => '',
'tlsSettings' => '',
'dnsSettings' => ''
];
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
];
}
}