Issues (64)

app/Rules/CurrentPasswordCheckRule.php (1 issue)

1
<?php
2
3
namespace App\Rules;
4
5
use Illuminate\Contracts\Validation\Rule;
6
use Illuminate\Support\Facades\Hash;
7
8
class CurrentPasswordCheckRule implements Rule
9
{
10
    /**
11
     * Determine if the validation rule passes.
12
     *
13
     * @param string $attribute
14
     * @param mixed  $value
15
     *
16
     * @return bool
17
     */
18
    public function passes($attribute, $value)
19
    {
20
        return Hash::check($value, auth()->user()->password);
21
    }
22
23
    /**
24
     * Get the validation error message.
25
     *
26
     * @return string
27
     */
28
    public function message()
29
    {
30
        return __('The current password field does not match your password');
0 ignored issues
show
Bug Best Practice introduced by
The expression return __('The current p...t match your password') also could return the type array which is incompatible with the documented return type string.
Loading history...
31
    }
32
}
33