Passed
Push — dev5 ( 125e24...928bc2 )
by Ron
09:11
created

ValidatePassword   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A message() 0 3 1
A passes() 0 3 1
1
<?php
2
3
namespace App\Rules;
4
5
use Illuminate\Support\Facades\Hash;
6
use Illuminate\Support\Facades\Auth;
7
use Illuminate\Contracts\Validation\Rule;
8
9
class ValidatePassword implements Rule
10
{
11
    /**
12
     * Create a new rule instance.
13
     *
14
     * @return void
15
     */
16
    public function __construct()
17
    {
18
        //
19
    }
20
21
    /**
22
     * Determine if the validation rule passes.
23
     *
24
     * @param  string  $attribute
25
     * @param  mixed  $value
26
     * @return bool
27
     */
28
    public function passes($attribute, $value)
29
    {
30
        return Hash::check($value, Auth::user()->password);
31
    }
32
33
    /**
34
     * Get the validation error message.
35
     *
36
     * @return string
37
     */
38
    public function message()
39
    {
40
        return 'Your Current Password is Incorrect.';
41
    }
42
}
43