【发布时间】:2015-12-05 02:29:58
【问题描述】:
试图在 Laravel 5.1 中整理出这个新的 AuthServiceProvider。
<?php
namespace App\Providers;
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
public function boot(GateContract $gate)
{
$this->registerPolicies($gate);
$gate->define('test-permission', function ($user) {
return true;
});
}
在我的刀片中我尝试
@if (Gate::allows('test-permission'))
hello world.
@endif
我得不到爱。如果我把它改成Gate::denies('test-permission') hello world 渲染。
最终我想从我的 Entrust 数据中提取我的权限以将我的权限迁移到 Laravel 5.1 环境。
【问题讨论】:
标签: laravel authentication laravel-5.1