I am creating a custom guard where I need to access the Request object in order to get http headers. I have tried request()
but it is undefined in lumen.
How do I get access to Request object outside of an controller class?
Note: Not a duplicate of Laravel access request object outside controller
I've never used Lumen myself but you should be able to resolve the current request from the Service Container:
app('request');
You might have to pass the full class name:
app('Illuminate\Http\Request');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With