本文整理匯總了PHP中app\models\Permission::getKey方法的典型用法代碼示例。如果您正苦於以下問題:PHP Permission::getKey方法的具體用法?PHP Permission::getKey怎麽用?PHP Permission::getKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Permission
的用法示例。
在下文中一共展示了Permission::getKey方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: tableRoles
/**
* Returns a new table of all roles that have the specified permission.
*
* @param Permission $permission
*
* @return \Orchestra\Contracts\Html\Builder
*/
public function tableRoles(Permission $permission)
{
$roles = $permission->roles()->with('users');
return $this->table->of('permissions.roles', function (TableGrid $table) use($permission, $roles) {
$table->with($roles)->paginate(10);
$table->column('label', function (Column $column) {
$column->value = function (Role $role) {
return link_to_route('admin.roles.show', $role->label, [$role->getKey()]);
};
});
$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('users', function (Column $column) {
$column->value = function (Role $role) {
return $role->users->count();
};
});
$table->column('remove', function (Column $column) use($permission) {
$column->value = function (Role $role) use($permission) {
return link_to_route('admin.permissions.roles.destroy', 'Remove', [$permission->getKey(), $role->getKey()], ['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 from this role?']);
};
});
});
}