Laravel Auth检查所有页面 [英] Laravel auth check for all pages

查看:88
本文介绍了Laravel Auth检查所有页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了身份验证,它可以完美地工作.但是在检查内页时存在一些问题.例如

I have created the Authentication, and its working perfectly. But there is some problem in checking the inner pages. For example,

Route::get('/', array('before' => 'auth' , 'do'=> function(){
return View::make('home.index');
}));

索引页面仅对已登录的用户可见.但是无论何时我进入内页,例如example.com/products.产品页面无需登录即可显示.

The index page is only visible for logged in users. But whenever I have go to the inner pages, for example example.com/products. The products page can be visible without log in.

推荐答案

只需检查用户是否在您的视图中登录. 或限制所有控制器(如果使用) 或检查路由组",然后对整个路由组进行过滤: http://laravel.com/docs/routing#groups

Just check if user is logged in in your views. Or restrict all controller (if you use it) Or check Route Groups, and give a filter to whole group of routes: http://laravel.com/docs/routing#groups

这篇关于Laravel Auth检查所有页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆