Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ahmeda's avatar

make telescope open for only admins

I installed telescope from the Laravel docs and I need to make it open only for admins

I have multi-guard auth:

   'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],
        'admin' => [
            'driver' => 'session',
            'provider' => 'admins',
        ],
    ],

I follow this repo ( https://github.com/laravel/telescope/issues/294 ) and try all solutions there but not a single one works for me!

the final one is in TelescopeServiceProvider :

protected function authorization()
    {
        Auth::setDefaultDriver('admin');
        parent::authorization();
    }

Clear cache but still everyone can access :(

0 likes
4 replies
ahmeda's avatar
ahmeda
OP
Best Answer
Level 5

I solve the problem like this in TelescopeServiceProvider:

    protected function gate()
    {
        Gate::define('viewTelescope', function ($user) {
            return true;
        });
    }

    protected function authorization()
    {
        Auth::setDefaultDriver('admin');
        parent::authorization();
    }

And to check the authorization works you have to change APP_ENV to production in local otherwise will always open.

@sinnbeck Thanks

1 like

Please or to participate in this conversation.