isPhone() public méthode

Check if the device is a mobile phone.
public isPhone ( string $userAgent = null, array $httpHeaders = null ) : boolean
$userAgent string deprecated
$httpHeaders array deprecated
Résultat boolean
Exemple #1
0
 public function getPlatform()
 {
     if ($this->agent->isPhone()) {
         return 'phone';
     }
     if ($this->agent->isTablet()) {
         return 'tablet';
     }
     if ($this->agent->isMobile()) {
         return 'mobile';
     }
     if ($this->agent->isDesktop()) {
         return 'desktop';
     }
     if ($this->agent->isRobot()) {
         return 'robot';
     }
     return null;
 }
 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     $this->registerPolicies($gate);
     $gate->define('crud-users', function () {
         return \Auth::user()->isAdmin();
     });
     $gate->define('auth', function () {
         return \Auth::check();
     });
     $gate->define('home', function () {
         return Request::path() === '/' || Request::path() == 'home' || Request::path() == '' ? true : false;
     });
     $gate->define('admin/users', function () {
         return strpos(Request::path(), 'admin/users') === false ? true : false;
     });
     $gate->define('ismobile', function () {
         $agent = new Agent();
         return $agent->isMobile();
     });
     $gate->define('isphone', function () {
         $agent = new Agent();
         return $agent->isPhone();
     });
 }