laravel / horizon

Dashboard and code-driven configuration for Laravel queues.
https://laravel.com/docs/horizon
MIT License
3.83k stars 643 forks source link

Horizon Gate not work. 5.23 #1392

Closed David-Grass-Feria closed 6 months ago

David-Grass-Feria commented 6 months ago

Horizon Version

5.23

Laravel Version

10.10

PHP Version

8.2.15

Redis Driver

Predis

Redis Version

2.2

Database Driver & Version

Mysql

Description

  1. composer require laravel/horizon
  2. php artisan horizon:install
  3. /app/providers/horizonServiceProvider
protected function gate(): void
    {
        Gate::define('viewHorizon', function ($user) {
            return in_array($user->id, [
                1
            ]);
        });
    }
  1. APP_ENV=production

Anyone can open "http://localhost/horizon/dashboard". Even guests who are not logged in. Only the user with ID 1 should have access.

Steps To Reproduce

I dont know where the error is. But i think your Gate::authorize not work.

driesvints commented 6 months ago

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.