protected function getUser()
    {
        $userData = [];

        if (config('visitlog.log_user')) {
            $name = '';
            $userNameFields = config('visitlog.user_name_fields');

            if (Auth::check()) {
                $user = Auth::user();
                $userData['user_id'] = $user->id;

                if (is_array($userNameFields)) {
                    foreach ($userNameFields as $userNameField) {
                        $name .= @$user->$userNameField . ' ';
                    }

                    $name = rtrim($name);
                } else {
                    $name = @$user->$userNameFields;
                }

                $userData['user_name'] = $name;
            } else {
                $userData['user_id'] = 0;
                $userData['user_name'] = 'Guest';
            }
        }

        return $userData;
    }
protected function getUser()
    {
        $userData = [];

        if (config('visitlog.log_user')) {
            $name = '';
            $userNameFields = config('visitlog.user_name_fields');

            if (Auth::check()) {
                $user = Auth::user();
                $userData['user_id'] = $user->id;

                if (is_array($userNameFields)) {
                    foreach ($userNameFields as $userNameField) {
                        $name .= @$user->$userNameField . ' ';
                    }

                    $name = rtrim($name);
                } else {
                    $name = @$user->$userNameFields;
                }

                $userData['user_name'] = $name;
            } else {
                $userData['user_id'] = 0;
                $userData['user_name'] = 'Guest';
            }
        }

        return $userData;
    }
protected function getUser ( ) { $ userData = [ ] ; if ( config ( 'visitlog.log_user' ) ) { $ name = '' ; $ userNameFields = config ( 'visitlog.user_name_fields' ) ; if ( Auth :: check ( ) ) { $ user = Auth :: user ( ) ; $ userData [ 'user_id' ] = $ user -> id ; if ( is_array ( $ userNameFields ) ) { foreach ( $ userNameFields as $ userNameField ) { $ name .= @ $ user -> $ userNameField . ' ' ; } $ name = rtrim ( $ name ) ; } else { $ name = @ $ user -> $ userNameFields ; } $ userData [ 'user_name' ] = $ name ; } else { $ userData [ 'user_id' ] = 0 ; $ userData [ 'user_name' ] = 'Guest' ; } } return $ userData ; }
Gets logged user info.
Gets logged user info .