vendredi 4 décembre 2015

laravel 5.1 authserviceprovider define a permission

Trying to sort out this new AuthServiceProvider in Laravel 5.1.

<?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;
    });

}

In my blade I try

@if (Gate::allows('test-permission'))
    hello world.
@endif

I get no love. If I change it to Gate::denies('test-permission') the hello world renders.

Ultimate I want to pull my permissions from my Entrust data to migrate my permissions to a Laravel 5.1 environment.



via Chebli Mohamed

2 commentaires:

Unknown a dit…
Ce commentaire a été supprimé par l'auteur.
Unknown a dit…

I have the same problem here. Do you solved this?

Enregistrer un commentaire