我搜索了有关我要解决的两个问题的信息,但我无法清楚地了解如何解决这个问题。特别是,对于Laravel 5.3来说,很多事情都发生了变化,信息比以前的版本少。
非常感谢你的帮助。
祝您度过愉快的一天。
何塞拉拉。答案 0 :(得分:0)
这是第二个问题的答案。
AdminController中的如何将未经授权的人或订户重定向到登录名或 不受限制的页面,或者我们可以对页面说,每个人都可以 访问。
不会忘记使用使用身份验证;
public function __construct()
{
$this->middleware('admin);
}
public function index()
{
return view('adminpanelview');
}
in **HomeController**
public function index()
{
return view('homeview');
}
**Web.php** route will be like
Route::get('/Admin',['uses'=>'AdminCotroller@index','as'=>'admin']);
Route::get('/home',['uses'=>'homeCotroller@index','as'=>'home']);
in **Admin.php** we should put the below code
public function handle($request, Closure $next)
{
if(!Auth::user()->admin)
{
return redirect()->route('home');
//return to non
}
return $next($request);
}
in **Kernel.php** **protected $routeMiddleware** we should register this middleware
'admin' => \App\Http\Middleware\Admin::class
答案 1 :(得分:0)
要回答第一个问题,请首先检测设备(可以使用Jenssegers Agent之类的东西)并相应地从其他目录加载刀片视图,您可以通过更改config\view.php
文件
<?php
$agent = new Jenssegers\Agent\Agent(); // Load the provider
$viewBasePath = realpath(base_path('resources/views')); // Save default path
$viewsPaths = [$viewBasePath];
if ($agent->isMobile()) { // If the device is mobile
// Load same view by name but from the mobile directory
array_unshift($viewsPaths, $viewBasePath.'/mobile');
}
return [
'paths' => $viewsPaths,
...............
答案 2 :(得分:-1)
我猜您的1号问题与刀片模板(视图)有关。如果正确,则刀片模板(视图)与引导集成有关。您的要求是,引导移动视图可以为您解决这个问题。转到[https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_default&stacked=h][1],您将对自己想要的东西有更好的了解。