Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Argument 1 passed to App\Rules\ValidatePassword::__construct() must be an instance of App\Models\User, integer given, called in C:\laragon\www\App\app\Http\Requests\PasswordSetting.php on line 18
- PasswordSetting request form:
- public function rules()
- {
- return [
- 'password' => 'required', new ValidatePassword(\Auth::user()->id),
- 'new_password' => 'required|required_with:repassword|same:repassword',
- 'repassword' => 'required'
- ];
- }
- Rules:
- public function __construct(User $user)
- {
- $this->user = $user;
- }
- /**
- * Determine if the validation rule passes.
- *
- * @param string $attribute
- * @param mixed $value
- * @return bool
- */
- public function passes($attribute, $value)
- {
- return bcrypt($value) === $this->user->password;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement