Created
March 11, 2016 20:12
-
-
Save vinicius73/911884bdbd03d80413ea to your computer and use it in GitHub Desktop.
Para vc não precisar fazer um loop nas suas permissões :p
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Core\Providers; | |
use Illuminate\Contracts\Auth\Access\Gate as GateContract; | |
use Illuminate\Support\ServiceProvider; | |
use App\Domains\Users\User; | |
class AuthServiceProvider extends ServiceProvider | |
{ | |
public function boot(GateContract $gate) | |
{ | |
$gate->before(function ($user, $permission, $args) use ($gate) { | |
// GATE not have this ability | |
if ($user instanceof User && !$gate->has($permission)) { | |
// return $user->canDo($permission) | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment