/** * Returns a new table for the specified role permissions. * * @param Role $role * * @return \Orchestra\Contracts\Html\Builder */ public function tablePermissions(Role $role) { $permissions = $role->permissions()->orderBy('name'); return $this->table->of('roles.permissions', function (TableGrid $table) use($role, $permissions) { $table->with($permissions)->paginate(10); $table->pageName = 'permissions'; $table->column('label', function (Column $column) { $column->value = function (Permission $permission) { return link_to_route('admin.permissions.show', $permission->label, [$permission->id]); }; }); $table->column('name', function (Column $column) { // We'll remove this column when // viewing on smaller screens. $column->headers = ['class' => 'hidden-xs']; $column->attributes(function () { return ['class' => 'hidden-xs']; }); }); $table->column('remove', function (Column $column) use($role) { $column->value = function (Permission $permission) use($role) { return link_to_route('admin.roles.permissions.destroy', 'Remove', [$role->id, $permission->id], ['class' => 'btn btn-xs btn-danger', 'data-post' => 'DELETE', 'data-title' => 'Are you sure?', 'data-message' => 'Are you sure you want to remove this permission?']); }; }); }); }