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(); }); }