Skip to content
Permalink
Browse files

inject prefix

  • Loading branch information
taylorotwell committed Nov 15, 2019
1 parent b204042 commit d77ce36917510d5a6800dd4116a4e18b7bf720b3
@@ -229,7 +229,8 @@ protected function createPusherDriver(array $config)
protected function createRedisDriver(array $config)
{
return new RedisBroadcaster(
$this->app->make('redis'), $config['connection'] ?? null
$this->app->make('redis'), $config['connection'] ?? null,
$this->app['config']->get('database.redis.options.prefix', '')
);
}
@@ -24,16 +24,25 @@ class RedisBroadcaster extends Broadcaster
*/
protected $connection;
/**
* The Redis key prefix.
*
* @var string
*/
protected $prefix;
/**
* Create a new broadcaster instance.
*
* @param \Illuminate\Contracts\Redis\Factory $redis
* @param string|null $connection
* @param string $prefix
* @return void
*/
public function __construct(Redis $redis, $connection = null)
public function __construct(Redis $redis, $connection = null, $prefix = '')
{
$this->redis = $redis;
$this->prefix = $prefix;
$this->connection = $connection;
}
@@ -47,8 +56,9 @@ public function __construct(Redis $redis, $connection = null)
*/
public function auth($request)
{
$channelName = str_replace(config('database.redis.options.prefix', ''), '', $request->channel_name);
$channelName = $this->normalizeChannelName($channelName);
$channelName = $this->normalizeChannelName(
str_replace($this->prefix, '', $request->channel_name)
);
if ($this->isGuardedChannel($request->channel_name) &&
! $this->retrieveUser($request, $channelName)) {

0 comments on commit d77ce36

Please sign in to comment.
You can’t perform that action at this time.