passwordReminder = $passwordReminder; } /** * Set the userId and create a random token * @param $userId * @throws StoreResourceFailedException * @return PasswordReminder */ public function store($userId) { $user = User::findOrFail($userId); $this->passwordReminder->userId = $user->id; $this->passwordReminder->token = bin2hex(openssl_random_pseudo_bytes(24)); if ($this->passwordReminder->save()) { return $this->passwordReminder; } else { throw new StoreResourceFailedException; } } /** * Destroy the password reminder means setting a new password for the user * @param Request $request * @param $userId */ public function destroy($userId, $reminderToken) { $user = Auth::user(); $user->password = Request::get('password'); $user->save(); return null; } }