For our applications we of course want to prevent access for non-authorized users and visitors.
But what if your application doesn’t have any users and you don’t want to manage things like passwords and or usernames — or perhaps you don’t even have a database?
Laravel’s defau lt basic auth-middleware still relies on the built in authentication system, so we won’t use that.
As the viewHorizon-gate wants a user-object, we can just allow a null value, and then return “true” (as the authentication is handled by the middleware): Now, in the horizon.php config-file, we tell Horizon to use the auth.very_basic-middleware: For the password and username, we can either set these in very_basic_auth.php, or if we prefer, directly inline with the middleware: Done! Now when you try to access your Horizon-route (by default /horizon) your will be prompted for your username and password: Check out the documentation for Horizon and olssonm/l5-very-basic-auth to learn more about these packages.