How to Get the User Agent Using Laravel
In this lesson, we will see how to get the user agent using Laravel, in some cases, we need to retrieve the user agent in our Laravel application so how we can do that?
Retrieve the user agent using request
To do that let's see the example below:
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
Route::get('/', function (Request $request) {
return $request->userAgent();
});