if
2 years ago

Using request() helper in custom helper

Posted 2 years ago by if

Hello , I'm trying to get user Operating system and Browser using the HTTP_USER_AGENT in my custom helper . Here's the code I used

$user_agent = request()->headers->get('User-Agent');

But I get this error :

PHP Fatal error: Uncaught exception 'ReflectionException' with message 'Class request does not exist' in /.../vendor/laravel/framework/src/Illuminate/Container/Container.php:729 Thank you

Please sign in or create an account to participate in this conversation.