TaskRequest.php
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace App\Http\Requests\Aside\Task;
use App\Helper\Arr;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class TaskRequest
* @package App\Http\Requests\Aside\product
* @author zbj
* @date 2023/4/27
*/
class TaskRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'project_id' => 'required|exists:gl_project,id',
'owner' => 'required',
'workload' => 'integer|max:5',
'priority' => 'integer|max:5',
'content' => 'required',
'attachment' => 'max:200',
'end_at' => 'date_format:Y-m-d H:i:s',
];
}
public function messages()
{
return [
'project_id.required' => '项目ID不能为空',
'project_id.exists' => '项目不存在',
'owner.required' => '请选择负责人',
'workload.max' => '工作量最多5星',
'priority.max' => '紧急程度最多5星',
'content' => '请输入工单内容',
'end_at.date_format' => '截止时间格式不正确',
];
}
}