Bristol SU Support Package
Public Member Functions | Protected Attributes | List of all members
BristolSU\Support\Permissions\Models\ModelPermission Class Reference
Inheritance diagram for BristolSU\Support\Permissions\Models\ModelPermission:
Inheritance graph
[legend]
Collaboration diagram for BristolSU\Support\Permissions\Models\ModelPermission:
Collaboration graph
[legend]

Public Member Functions

 moduleInstance ()
 
 scopeUser (Builder $query, ?int $userId=null, ?string $ability=null, ?int $moduleInstanceId=null)
 
 scopeLogic (Builder $query, ?int $logicId=null, ?string $ability=null, ?int $moduleInstanceId=null)
 
 scopeGroup (Builder $query, ?int $groupId=null, ?string $ability=null, ?int $moduleInstanceId=null)
 
 scopeRole (Builder $query, ?int $roleId=null, ?string $ability=null, ?int $moduleInstanceId=null)
 
- Public Member Functions inherited from BristolSU\Support\Revision\HasRevisions
 initializeHasRevisions ()
 
 getSystemUserId ()
 

Protected Attributes

 $table = 'model_permissions'
 
 $fillable
 
 $casts
 
- Protected Attributes inherited from BristolSU\Support\Revision\HasRevisions
 $historyLimit
 
 $revisionCleanup
 

Detailed Description

Represents a permission assigned to a model.

static Builder user(?int $userId = null, ?string $ability = null, ?int $moduleInstanceId = null) Get all permissions assigned to the user with the given parameters static Builder group(?int $groupId = null, ?string $ability = null, ?int $moduleInstanceId = null) Get all permissions assigned to the group with the given parameters static Builder role(?int $roleId = null, ?string $ability = null, ?int $moduleInstanceId = null) Get all permissions assigned to the role with the given parameters static Builder logic(?int $logicId = null, ?string $ability = null, ?int $moduleInstanceId = null) Get all permissions assigned to the logic group with the given parameters

Definition at line 18 of file ModelPermission.php.

Member Function Documentation

◆ moduleInstance()

BristolSU\Support\Permissions\Models\ModelPermission::moduleInstance ( )

The related module instance

If the model permission belongs to a module instance, it is a module permission.

Returns

Definition at line 57 of file ModelPermission.php.

◆ scopeGroup()

BristolSU\Support\Permissions\Models\ModelPermission::scopeGroup ( Builder  $query,
?int  $groupId = null,
?string  $ability = null,
?int  $moduleInstanceId = null 
)

Get model permissions for a group with the given attributes.

Parameters
Builder$queryQuery object to mutate
int | null$groupIdGroup ID to return model permissions for. Leave null to return all Group IDs.
string | null$abilityAbility the model permissions should have. Leave null to return all abilities.
int | null$moduleInstanceIdThe module instance the model permission should have. Leave null to return all module instances.
Returns
Builder

Definition at line 119 of file ModelPermission.php.

◆ scopeLogic()

BristolSU\Support\Permissions\Models\ModelPermission::scopeLogic ( Builder  $query,
?int  $logicId = null,
?string  $ability = null,
?int  $moduleInstanceId = null 
)

Get model permissions for a logic group with the given attributes

Parameters
Builder$queryQuery object to mutate
int | null$logicIdLogic ID to return model permissions for. Leave null to return all Logic IDs.
string | null$abilityAbility the model permissions should have. Leave null to return all abilities.
int | null$moduleInstanceIdThe module instance the model permission should have. Leave null to return all module instances.
Returns
Builder

Definition at line 95 of file ModelPermission.php.

◆ scopeRole()

BristolSU\Support\Permissions\Models\ModelPermission::scopeRole ( Builder  $query,
?int  $roleId = null,
?string  $ability = null,
?int  $moduleInstanceId = null 
)

Get model permissions for a role with the given attributes.

Parameters
Builder$queryQuery object to mutate
int | null$roleIdRole ID to return model permissions for. Leave null to return all Role IDs.
string | null$abilityAbility the model permissions should have. Leave null to return all abilities.
int | null$moduleInstanceIdThe module instance the model permission should have. Leave null to return all module instances.
Returns
Builder

Definition at line 143 of file ModelPermission.php.

◆ scopeUser()

BristolSU\Support\Permissions\Models\ModelPermission::scopeUser ( Builder  $query,
?int  $userId = null,
?string  $ability = null,
?int  $moduleInstanceId = null 
)

Get model permissions for a user with the given attributes.

Parameters
Builder$queryQuery object to mutate
int | null$userIdUser ID to return model permissions for. Leave null to return all User IDs.
string | null$abilityAbility the model permissions should have. Leave null to return all abilities.
int | null$moduleInstanceIdThe module instance the model permission should have. Leave null to return all module instances.
Returns
Builder

Definition at line 71 of file ModelPermission.php.

Member Data Documentation

◆ $casts

BristolSU\Support\Permissions\Models\ModelPermission::$casts
protected
Initial value:
= [
'result' => 'boolean'
]

Definition at line 46 of file ModelPermission.php.

◆ $fillable

BristolSU\Support\Permissions\Models\ModelPermission::$fillable
protected
Initial value:
= [
'ability',
'model',
'model_id',
'result',
'module_instance_id'
]

Definition at line 33 of file ModelPermission.php.

◆ $table

BristolSU\Support\Permissions\Models\ModelPermission::$table = 'model_permissions'
protected

Definition at line 26 of file ModelPermission.php.


The documentation for this class was generated from the following file: