public function loginLog(User $user, array $geoIp)
    {
        $geoIp['date'] = date('Y-m-d H:i:s');
        $loginIps = $user->getAttribute('lastLoginIps');

        if (!$loginIps) {
            $loginIps = [];
        }

        array_unshift($loginIps, $geoIp);
        $loginIps = array_slice($loginIps, 0, 3);

        $user->setAttribute('lastLoginIps', $loginIps);
        $this->dm->persist($user);
        $this->dm->flush();

        return $this;
    }
public function loginLog(User $user, array $geoIp)
    {
        $geoIp['date'] = date('Y-m-d H:i:s');
        $loginIps = $user->getAttribute('lastLoginIps');

        if (!$loginIps) {
            $loginIps = [];
        }

        array_unshift($loginIps, $geoIp);
        $loginIps = array_slice($loginIps, 0, 3);

        $user->setAttribute('lastLoginIps', $loginIps);
        $this->dm->persist($user);
        $this->dm->flush();

        return $this;
    }
public function loginLog ( User $ user , array $ geoIp ) { $ geoIp [ 'date' ] = date ( 'Y-m-d H:i:s' ) ; $ loginIps = $ user -> getAttribute ( 'lastLoginIps' ) ; if ( ! $ loginIps ) { $ loginIps = [ ] ; } array_unshift ( $ loginIps , $ geoIp ) ; $ loginIps = array_slice ( $ loginIps , 0 , 3 ) ; $ user -> setAttribute ( 'lastLoginIps' , $ loginIps ) ; $ this -> dm -> persist ( $ user ) ; $ this -> dm -> flush ( ) ; return $ this ; }
Save login geoIp last 20 events

@param  User  $user
@param  array $geoIp

@return self
Save login geoIp last 20 events