对我来说,问题是我设置了app\Providers\HorizonServiceProvider.php
:
/**
* Register the Horizon gate.
*
* This gate determines who can access Horizon in non-local environments.
*
* @return void
*/
protected function gate() {
Gate::define('viewHorizon', function ($user) {//https://laravel.com/docs/7.x/horizon#dashboard-authorization
return $user->id === \App\Constants\Permissions::ADMIN_USER_ID;
});
}
然后我忘记了,我需要先登录 example.com/login,然后才能访问 example.com/horizon。
请参阅https://github.com/laravel/horizon /issues/563#issuecomment-500821983和https://laravel.com/docs/8.x/horizon#dashboard-authorization