Get useragent in controller laravel 5 php

Solution:

You can use either of following ways:

$ua = $request->server('HTTP_USER_AGENT');

$ua = $request->header('User-Agent');