class Permission extends Model (View source)

Constants

SCOPE_GLOBAL

Constant that represents a list of permissions that belongs to the global scope.

SCOPE_MODULE

Constant that represents a list of permissions that belongs to the module scope.

SCOPE_ITEM

Constant that represents a list of permissions that belongs to the module item scope.

Properties

protected $fillable
protected $appends

Methods

__construct(array $attributes = [])

No description

static string[]|void
available(string $scope)

Return an array of permission names that belongs to a certain scope (global, module or item).

static Collection
permissionableModules()

Retrieve the list of modules that permissions can be applied to.

static Collection
permissionableParentModuleItems()

Retrieve a collection of items that belongs to keyed by permissionable module names.

MorphTo
permissionable()

Get the parent permissionable model (one of the permissionale module).

BelongsToMany
users()

User model relationship

BelongsToMany
roles()

Role model relationship

BelongsToMany
groups()

Group model relationship

Builder
scopeGlobal(Builder $query)

Scope a query to only include global scope permissions.

Builder
scopeModule(Builder $query)

Scope a query to only include module scope permissions.

Builder
scopeModuleItem(Builder $query)

Scope a query to only include module item scope permissions.

Builder
scopeOfItem(Builder $query, Model $item)

Scope a query to only include permissions related to an item.

Builder
scopeOfModuleName(Builder $query, string $moduleName)

Scope a query to only include permissions related to a Twill module.

Builder
scopeOfModel(Builder $query, string $model)

Scope a query to only include permissions related to a model.

string
getPermissionableModuleAttribute()

Get the permissionable module type of current permission

Details

__construct(array $attributes = [])

No description

Parameters

array $attributes

static string[]|void available(string $scope)

Return an array of permission names that belongs to a certain scope (global, module or item).

Parameters

string $scope

Return Value

string[]|void

static Collection permissionableModules()

Retrieve the list of modules that permissions can be applied to.

Return Value

Collection

static Collection permissionableParentModuleItems()

Retrieve a collection of items that belongs to keyed by permissionable module names.

Return Value

Collection

MorphTo permissionable()

Get the parent permissionable model (one of the permissionale module).

Return Value

MorphTo

BelongsToMany users()

User model relationship

Return Value

BelongsToMany

BelongsToMany roles()

Role model relationship

Return Value

BelongsToMany

BelongsToMany groups()

Group model relationship

Return Value

BelongsToMany

Builder scopeGlobal(Builder $query)

Scope a query to only include global scope permissions.

Parameters

Builder $query

Return Value

Builder

Builder scopeModule(Builder $query)

Scope a query to only include module scope permissions.

Parameters

Builder $query

Return Value

Builder

Builder scopeModuleItem(Builder $query)

Scope a query to only include module item scope permissions.

Parameters

Builder $query

Return Value

Builder

Builder scopeOfItem(Builder $query, Model $item)

Scope a query to only include permissions related to an item.

Parameters

Builder $query
Model $item

Return Value

Builder

Builder scopeOfModuleName(Builder $query, string $moduleName)

Scope a query to only include permissions related to a Twill module.

Parameters

Builder $query
string $moduleName

Return Value

Builder

Builder scopeOfModel(Builder $query, string $model)

Scope a query to only include permissions related to a model.

Parameters

Builder $query
string $model

Return Value

Builder

string getPermissionableModuleAttribute()

Get the permissionable module type of current permission

Return Value

string