Advertisement
Guest User

Untitled

a guest
Sep 6th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. 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
  2.  
  3. PasswordSetting request form:
  4. public function rules()
  5. {
  6. return [
  7. 'password' => 'required', new ValidatePassword(\Auth::user()->id),
  8. 'new_password' => 'required|required_with:repassword|same:repassword',
  9. 'repassword' => 'required'
  10. ];
  11. }
  12.  
  13. Rules:
  14. public function __construct(User $user)
  15. {
  16. $this->user = $user;
  17. }
  18.  
  19. /**
  20. * Determine if the validation rule passes.
  21. *
  22. * @param string $attribute
  23. * @param mixed $value
  24. * @return bool
  25. */
  26. public function passes($attribute, $value)
  27. {
  28. return bcrypt($value) === $this->user->password;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement