How to get user agent value in Laravel 5?

By Hardik Savani | April 5, 2016 | | 47916 Viewer | Category : Laravel


If you are work on laravel 5 application and you require to get user agent(user agent mean user browser details like firefox, cherome etc) then you can get easy. you don't need to use $_SERVER variable like native PHP, but laravel 5 provide Request facade. you can fetch easy using following example:

Example

public function ImpressionCount(Request $request)

{

$impre['useragent'] = $request->server('HTTP_USER_AGENT');

$input['ip'] = $request->ip();

print($input);

}



Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
***Do you want me hire for your Project Work? Then Contact US.