skip to Main Content

IlluminateFoundationBootstrapHandleExceptions::handleError
vendor/mehedi-iitdu/core-component-repository/src/CoreComponentRepository.php:19

This is the code here

public static function initializeCache() {

        Cache::rememberForever($addon->unique_identifier.'-purchased', function () {

            return 'yes';

        });

    }

Please help me this is happening when i try to login in to the admin panel. rest is working fine. I have Php 7.4 with ubuntu os in plesk.

2

Answers


  1. Your $addon variable is never defined in this function, and that’s what the error is referring to. There are two options:

    1. Pass it in your function where you’re calling it and accept that parameter:
    public static function initializeCache($addon) { //Param here
            Cache::rememberForever($addon->unique_identifier.'-purchased', function () {
                return 'yes';
            });
        }
    
    1. Define in the beggining of the function
        public static function initializeCache() {
            $addon = 'Whatever this value has to be'; //Maybe load from database or config
            Cache::rememberForever($addon->unique_identifier.'-purchased', function () {
                return 'yes';
            });
        }
    
    Login or Signup to reply.
  2. public static function initializeCache() {
       foreach(Addon::all() as $addon){
            if ($addon->purchase_code == null) {
                self::finalizeCache($addon);
            }
    
        Cache::rememberForever($addon->unique_identifier.'-purchased', 
            function () {
    
            return 'yes';
    
        });
    

    }
    }

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search