Ekapp/skolehjem/app/Helpers/Detector.php

25 lines
570 B
PHP
Raw Normal View History

<?php
namespace App\Helpers;
2020-08-27 08:59:19 +00:00
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);
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-08-27 08:59:19 +00:00
2020-08-27 09:12:43 +00:00
return view("errors.403", $args);
}
}