public function buildLink($userId, $ip, $userAgent)
    {
        $link = new UserLink();
        $link->user_id = $userId;
        $link->type = UserLink::FORGOT_PASSWORD;

        try {
            $link->save();
        } catch (\Exception $e) {
            throw new \Exception("Could not create reset password link for user # $userId: ".$e->getMessage());
        }

        // record the reset password request event
        $event = new AccountSecurityEvent();
        $event->user_id = $userId;
        $event->type = AccountSecurityEvent::RESET_PASSWORD_REQUEST;
        $event->ip = $ip;
        $event->user_agent = $userAgent;
        $event->save();

        return $link;
    }
public function buildLink($userId, $ip, $userAgent)
    {
        $link = new UserLink();
        $link->user_id = $userId;
        $link->type = UserLink::FORGOT_PASSWORD;

        try {
            $link->save();
        } catch (\Exception $e) {
            throw new \Exception("Could not create reset password link for user # $userId: ".$e->getMessage());
        }

        // record the reset password request event
        $event = new AccountSecurityEvent();
        $event->user_id = $userId;
        $event->type = AccountSecurityEvent::RESET_PASSWORD_REQUEST;
        $event->ip = $ip;
        $event->user_agent = $userAgent;
        $event->save();

        return $link;
    }
public function buildLink ( $ userId , $ ip , $ userAgent ) { $ link = new UserLink ( ) ; $ link -> user_id = $ userId ; $ link -> type = UserLink :: FORGOT_PASSWORD ; try { $ link -> save ( ) ; } catch ( \ Exception $ e ) { throw new \ Exception ( "Could not create reset password link for user # $userId: " . $ e -> getMessage ( ) ) ; } // record the reset password request event $ event = new AccountSecurityEvent ( ) ; $ event -> user_id = $ userId ; $ event -> type = AccountSecurityEvent :: RESET_PASSWORD_REQUEST ; $ event -> ip = $ ip ; $ event -> user_agent = $ userAgent ; $ event -> save ( ) ; return $ link ; }
Builds a reset password link.

@param int    $userId
@param string $ip
@param string $userAgent

@return UserLink
Builds a reset password link .