/** * Run the database seeds. * * @return void */ public function run() { $permissions = R::allPermissions(); foreach ($permissions as $name => $display_name) { Permission::create(compact('name', 'display_name')); } }
/** * define all permissions * * @return void */ public function definePermissions(Gate $gate) { $permissions = Role::allPermissions(); foreach ($permissions as $permission => $value) { $gate->define($permission, function (User $user) use($permission) { return $user->hasPermission($permission); }); } }