Passed
Branch dev5a (b4693d)
by Ron
27:36
created

UserPasswordRequest::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
namespace App\Http\Requests\User;
4
5
use Illuminate\Support\Facades\Auth;
6
use Illuminate\Foundation\Http\FormRequest;
7
8
use App\Rules\ValidatePassword;
9
10
class UserPasswordRequest extends FormRequest
11
{
12
    /**
13
     * Determine if the user is authorized to make this request.
14
     *
15
     * @return bool
16
     */
17 4
    public function authorize()
18
    {
19 4
        return Auth::check();
20
    }
21
22
    /**
23
     * Get the validation rules that apply to the request.
24
     *
25
     * @return array
26
     */
27 4
    public function rules()
28
    {
29
        return [
30 4
            'current'  => ['required', new ValidatePassword],
31 4
            'password' => 'required|string|min:6|confirmed|different:current'
32
        ];
33
    }
34
}
35