Check Mobile Device or Desktop Laravel 5.8

In this blog post, we learn how to check a mobile device or desktop Laravel 5.8. this post we will use a package “jenssegers/agent”

In many times need to need to detect devices using the application. we have a Jessenger agent package for the detection of mobile or desktop in Laravel 5.8. we can easily check which devices use users like mobile, tablet or desktop. this package has plugin provide a method to get all user device information the package “Jessenger” provide function like isMobile(), isTablet(), isDesktop() and device().

This package can easily use in all version of need to just follow bellow tutorial to detect mobile or desktop access device.

Step:1 Install package using composer 

To install package use this flowing command

composer require jenssegers/agent

After that, successfully install the package we need to set providers and alias.

Step:2 Set Providers


'providers' => [
'aliases' => [
	'Agent' => Jenssegers\Agent\Facades\Agent::class,

Step:3 Create some route to return result

For Detect mobile device

Route::get('detect', function()
    $agent = new \Jenssegers\Agent\Agent;
    $mobileResult = $agent->isMobile();
      $result = $mobileResult;
    $desktopResult= $agent->isDesktop();
      $result = $desktopResult;
    $tabletResult= $agent->isTablet();
      $result = $tabletResult;

So we complated blog on check mobile device or desktop Laravel 5.8