25 lines
605 B
PHP
25 lines
605 B
PHP
<?php
|
|
|
|
|
|
namespace App\Helpers;
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Jenssegers\Agent\Agent;
|
|
|
|
class Detector
|
|
{
|
|
public static function View($viewName, $args) {
|
|
|
|
$agent = new Agent();
|
|
|
|
if($agent->isMobile()) {
|
|
return view(config("detector.mobilePath") . "." . $viewName, $args);
|
|
} else if(Auth()->user() !== null) {
|
|
if (Auth()->user()->can('admin.panel.show') == true)
|
|
return view(config("detector.defaultPath") . "." . $viewName, $args);
|
|
}
|
|
|
|
return view(config("detector.mobilePath") . "." . $viewName, $args);
|
|
}
|
|
}
|