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

63 lines
2.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;
class UserUpdate extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
2020-07-15 15:57:12 +08:00
return [
'email' => 'required|email',
'password' => 'nullable',
'transfer_enable' => 'numeric',
'expired_at' => 'nullable|integer',
'banned' => 'required|in:0,1',
'plan_id' => 'nullable|integer',
'commission_rate' => 'nullable|integer|min:0|max:100',
'discount' => 'nullable|integer|min:0|max:100',
'is_admin' => 'required|in:0,1',
2020-09-19 22:52:05 +08:00
'is_staff' => 'required|in:0,1',
2020-07-15 15:57:12 +08:00
'u' => 'integer',
'd' => 'integer',
'balance' => 'integer',
'commission_balance' => 'integer'
];
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 [
'email.required' => '邮箱不能为空',
'email.email' => '邮箱格式不正确',
'transfer_enable.numeric' => '流量格式不正确',
'expired_at.integer' => '到期时间格式不正确',
2020-03-02 20:29:17 +08:00
'banned.required' => '是否封禁不能为空',
'banned.in' => '是否封禁格式不正确',
2019-10-29 15:33:36 +08:00
'is_admin.required' => '是否管理员不能为空',
2019-11-27 20:07:31 +08:00
'is_admin.in' => '是否管理员格式不正确',
2020-09-19 22:52:05 +08:00
'is_staff.required' => '是否员工不能为空',
'is_staff.in' => '是否员工格式不正确',
2019-11-27 20:07:31 +08:00
'plan_id.integer' => '订阅计划格式不正确',
'commission_rate.integer' => '推荐返利比例格式不正确',
2019-12-17 15:52:19 +08:00
'commission_rate.nullable' => '推荐返利比例格式不正确',
2019-11-27 20:07:31 +08:00
'commission_rate.min' => '推荐返利比例最小为0',
2020-02-14 18:24:59 +08:00
'commission_rate.max' => '推荐返利比例最大为100',
'discount.integer' => '专属折扣比例格式不正确',
'discount.nullable' => '专属折扣比例格式不正确',
'discount.min' => '专属折扣比例最小为0',
2020-02-28 16:35:40 +08:00
'discount.max' => '专属折扣比例最大为100',
'u.integer' => '上行流量格式不正确',
'd.integer' => '下行流量格式不正确',
2020-03-01 17:57:50 +08:00
'balance.integer' => '余额格式不正确',
'commission_balance.integer' => '佣金格式不正确'
2019-10-29 15:33:36 +08:00
];
}
}