laravel5 ACL 权限认证问题

WBOY
Release: 2016-06-06 20:15:39
Original
1639 people have browsed it

链接描述

按照这个教程做好了权限功能,可是要是有很多控制器很多方法,难道要在每一个方法前面做一个判断权限的语句吗,有没有更简单更智能的方法

回复内容:

链接描述

按照这个教程做好了权限功能,可是要是有很多控制器很多方法,难道要在每一个方法前面做一个判断权限的语句吗,有没有更简单更智能的方法

可以使用 laravel 的中间件的功能,你自定义一个中间件,然后在 Route 那里配置一下,这个单独的路由,或者group路由要经过这个 ACL 的权限,才能运行下去。
就不用在每个控制器里面写了

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!