Last active
March 9, 2019 15:45
-
-
Save mustafat0k/59387320004705fa0f68934c6c3e9715 to your computer and use it in GitHub Desktop.
AppServiceProvider GateContract
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 | |
public function boot(GateContract $gate) // Bu kısmı 5.5 de boş boot() şeklinde muhtemelen sadece 5.3 de bu şekilde. | |
{ | |
$this->registerPolicies(); | |
foreach ($this->getPermissions() as $permission) { | |
$gate->define($permission->name, function($user) use ($permission ) { | |
return $user->hasRole($permission->roles()); | |
}); | |
} | |
} | |
protected function getPermissions(){ | |
return Permission::with('roles')->get(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment