Completed
Push — master ( 2bac5c...02fc6a )
by wen
02:51
created

ManagerRequest::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 20
rs 9.4285
cc 1
eloc 13
nc 1
nop 0
1
<?php
2
3
namespace Sco\Admin\Http\Requests;
4
5
use Illuminate\Validation\Rule;
6
7
class ManagerRequest extends BaseFormRequest
8
{
9
    /**
10
     * Determine if the user is authorized to make this request.
11
     *
12
     * @return bool
13
     */
14
    public function authorize()
15
    {
16
        return true;
17
    }
18
19
    /**
20
     * Get the validation rules that apply to the request.
21
     *
22
     * @return array
23
     */
24
    public function rules()
25
    {
26
        return [
27
            //'id'       => 'integer',
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
28
            'name'     => [
29
                'bail',
30
                'required',
31
                'regex:/^[\w]+$/',
32
                Rule::unique('managers')->ignore($this->input('id'))
33
            ],
34
            'email'    => [
35
                'bail',
36
                'email',
37
                'required',
38
                Rule::unique('managers')->ignore($this->input('id'))
39
            ],
40
            'password' => 'bail|required_without:id',
41
            //'sort'     => 'integer|between:0,255',
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
42
        ];
43
    }
44
45
    protected function getMessages()
46
    {
47
        return [
48
            'required_without' => '密码不能为空',
49
        ];
50
    }
51
52
    protected function getAttributes()
53
    {
54
        return [
55
            'name' => '管理员名称',
56
        ];
57
    }
58
59
}
60