So, with Laravel Horizon here, I ventured to use it. I found something though, it is possible, but VERY difficult to get the current user in the App Service Provider.
I set out a different route, using IP Addresses.
Since our office has a static IP, I modified the following:
.env - Adding the remote addresses as a JSON encoded array to a new variable
REMOTE_ADDRESSES='["xxx.xxx.xxx.xxx"]'
AppServiceProvider.php - Added logic in that will check the remote address against the array, if it is found, they get in.
Horizon::auth(function ($request) {
$address = $request->server->get('REMOTE_ADDR');
$allowed_addresses = json_decode(env('REMOTE_ADDRESSES'));
return (in_array($address, $allowed_addresses));
});
This allowed me to in the production enviorment, still view all of the queues and supervisors running across now 3 servers, 2 in the US, and 1 in the EU.
I just have to say, @taylorotwell, THANK YOU for this. I have been building my own every time for some type of interface that would do this, but this, is 100000x better.
@gibrandev did you do something else ? I've created the middleware it's applied but I still have a forbidden error.
Did you change something in the gate method in HorizonServiceProvider ?
I just want to filter with IP, no user logged at all