CurrentPassword   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 23
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A passes() 0 3 1
A message() 0 3 1
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