Skip to content

Instantly share code, notes, and snippets.

@mustafat0k
Last active March 9, 2019 15:45
Show Gist options
  • Save mustafat0k/59387320004705fa0f68934c6c3e9715 to your computer and use it in GitHub Desktop.
Save mustafat0k/59387320004705fa0f68934c6c3e9715 to your computer and use it in GitHub Desktop.
AppServiceProvider GateContract
<?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