diff --git a/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php b/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php index 340b550c8ebc..acd60e5b2278 100644 --- a/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php +++ b/src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php @@ -11,6 +11,7 @@ use Illuminate\Contracts\Routing\UrlRoutable; use Illuminate\Support\Arr; use Illuminate\Support\Reflector; +use Illuminate\Support\Facades\App; use ReflectionClass; use ReflectionFunction; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; @@ -119,13 +120,21 @@ protected function verifyUserCanAccessChannel($request, $channel) $result = $handler($this->retrieveUser($request, $channel), ...$parameters); if ($result === false) { - throw new AccessDeniedHttpException; + if (App::environment('production')) { + throw new AccessDeniedHttpException; + } else { + throw new AccessDeniedHttpException('User does not have access to this channel.'); + } } elseif ($result) { return $this->validAuthenticationResponse($request, $result); } } - throw new AccessDeniedHttpException; + if (App::environment('production')) { + throw new AccessDeniedHttpException; + } else { + throw new AccessDeniedHttpException('No matching pattern found or user authentication failed.'); + } } /**