Brijpal Sharma
laravel
Publish on:-August 08th, 2019 ,
Category:- Web Development
Brijpal Sharma
laravel
Publish on:-August 08th, 2019 ,
Category:- Web Development
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 Laravel.you need to just follow bellow tutorial to detect mobile or desktop access device.
To install package use this flowing command
composer require jenssegers/agent
After that, successfully install the package we need to set providers and alias.
config/app.php
'providers' => [
....
Jenssegers\Agent\AgentServiceProvider::class,
]
'aliases' => [
....
'Agent' => Jenssegers\Agent\Facades\Agent::class,
]
For Detect mobile device
Route::get('detect', function()
{
$agent = new \Jenssegers\Agent\Agent;
$mobileResult = $agent->isMobile();
if($mobileResult){
$result = $mobileResult;
}
$desktopResult= $agent->isDesktop();
if($desktopResult){
$result = $desktopResult;
}
$tabletResult= $agent->isTablet();
if($tabletResult){
$result = $tabletResult;
}
dd($result);
});
So we complated blog on check mobile device or desktop Laravel 5.8
Brijpal Sharma
Hello, My Name is Brijpal Sharma. I am a Web Developer, Professional Blogger and Digital Marketer from India. I am the founder of Codermen. I started this blog to help web developers & bloggers by providing easy and best tutorials, articles and offers for web developers and bloggers...
You must be logged in to post a comment.