CurrentPassword::message()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace App\Rules;
4
5
use Illuminate\Contracts\Validation\Rule;
6
use Illuminate\Support\Facades\Auth;
7
use Illuminate\Support\Facades\Hash;
8
9
class CurrentPassword implements Rule
10
{
11
    /**
12
     * Determine if the validation rule passes.
13
     *
14
     * @param string $attribute
15
     * @param mixed  $value
16
     *
17
     * @return bool
18
     */
19 1
    public function passes($attribute, $value)
20
    {
21 1
        return Hash::check($value, Auth::user()->password);
22
    }
23
24
    /**
25
     * Get the validation error message.
26
     *
27
     * @return string
28
     */
29 1
    public function message()
30
    {
31 1
        return trans('validation.current_password');
32
    }
33
}
34