How to get the user-agent information from the Request object?
Hi,
I need to save the agent information in a database after a user logs in.
I grab the ip like this
$request->ip();
How can I grab the user-gent data?
$request->server('HTTP_USER_AGENT');
use dd($request); to see more
success
@noeldiaz this package isn't updated recently and can use till laravel 8,
any other suggestion?!
In Laravel 10.x, the UA can be simply retrieved via the userAgent() method of the Request class, e.g.
$userAgent = $request->userAgent();
@DanielRønfeldt Congratulations, you win archaeologist of the day award, answering a 7 year old question.
Please or to participate in this conversation.