jeudi 19 mai 2022

Laravel 5: Call to undefined method Redis::connection()

I am using redis to publish notifications. Here is how I am suing it:

$redis = \Redis::connection();

I am using _ide_helper package so when I ctrl+click on connection method it takes me to _ide_helper.php:

class Redis extends \Illuminate\Support\Facades\Redis{
        
        /**
         * Get a specific Redis connection instance.
         *
         * @param string $name
         * @return \Predis\ClientInterface|null 
         * @static 
         */
        public static function connection($name = 'default'){
            return \Illuminate\Redis\Database::connection($name);
        }
}

So the method does exist. But it gives me the error:

Call to undefined method Redis::connection()

I am using Homestead with Ubuntu 18.04. My PHP version is 7.1.33 with Laravle 5.5. Whatam I doing wrong here? What is the solution?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire