v0.10.15h - Fixed admin access
This commit is contained in:
parent
5766770a4b
commit
c0669d6eda
|
@ -3,9 +3,7 @@
|
||||||
|
|
||||||
namespace App\Helpers;
|
namespace App\Helpers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
|
||||||
use Jenssegers\Agent\Agent;
|
use Jenssegers\Agent\Agent;
|
||||||
|
|
||||||
class Detector
|
class Detector
|
||||||
|
@ -16,7 +14,11 @@ class Detector
|
||||||
|
|
||||||
if($agent->isMobile()) {
|
if($agent->isMobile()) {
|
||||||
return view(config("detector.mobilePath") . "." . $viewName, $args);
|
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.defaultPath") . "." . $viewName, $args);
|
|
||||||
|
return view(config("detector.mobilePath") . "." . $viewName, $args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Jenssegers\Agent\Facades\Agent;
|
use Jenssegers\Agent\Facades\Agent;
|
||||||
|
|
||||||
|
@ -28,8 +29,12 @@ class DetectorServiceProvider extends ServiceProvider
|
||||||
Response::macro("detect", function ($view, $args = []) {
|
Response::macro("detect", function ($view, $args = []) {
|
||||||
if(Agent::isMobile()) {
|
if(Agent::isMobile()) {
|
||||||
return view(config("detector.mobilePath") . "." . $view, $args);
|
return view(config("detector.mobilePath") . "." . $view, $args);
|
||||||
|
} else if(Auth()->user() !== null){
|
||||||
|
if(Auth()->user()->can('admin.panel.show') == true)
|
||||||
|
return view(config("detector.defaultPath") . "." . $view, $args);
|
||||||
}
|
}
|
||||||
return view(config("detector.defaultPath") . "." . $view, $args);
|
|
||||||
|
return view(config("detector.mobilePath") . "." . $view, $args);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue