ikechukwukalu /
sanctumauthstarter
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Ikechukwukalu\Sanctumauthstarter\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 |
||
|
0 ignored issues
–
show
|
|||
| 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 | $user = Auth::user(); |
||
| 31 | return Hash::check($value, $user->password) || is_null($user->password); |
||
|
0 ignored issues
–
show
|
|||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Get the validation error message. |
||
| 36 | * |
||
| 37 | * @return string |
||
| 38 | */ |
||
| 39 | public function message() |
||
| 40 | { |
||
| 41 | return trans('sanctumauthstarter::passwords.wrong'); |
||
| 42 | } |
||
| 43 | } |
||
| 44 |
This interface has been deprecated. The supplier of the interface has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.