2020-06-22 19:08:09 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Helpers;
|
|
|
|
|
2020-08-27 08:59:19 +00:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
2020-06-22 19:08:09 +00:00
|
|
|
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);
|
2020-08-27 08:59:19 +00:00
|
|
|
} else if(Auth()->user() !== null) {
|
|
|
|
if (Auth()->user()->can('admin.panel.show') == true)
|
|
|
|
return view(config("detector.defaultPath") . "." . $viewName, $args);
|
2020-06-22 19:08:09 +00:00
|
|
|
}
|
2020-08-27 08:59:19 +00:00
|
|
|
|
2020-08-27 09:12:43 +00:00
|
|
|
return view("errors.403", $args);
|
2020-06-22 19:08:09 +00:00
|
|
|
}
|
|
|
|
}
|