trait EntityPermissions

Entity permissions

Methods

Relation|null
entity()

Get entity relation

Relation|null
permission()

Get permission relation

string
getNameAttribute()

Get permission name attribute

Relation|null
related()

Morphed models

bool
deleteUserPermission(integer $entityId, integer $userId)

Delete user permission

bool
deleteGroupPermission(integer $entityId, integer $groupId)

Delete group permission

Model|false
addUserPermission(integer $entityId, integer $userId, array $permissions, integer|null $permissionId = null)

Add user permission

Model|false
addGroupPermission(integer $entityId, integer $groupId, array $permissions, integer|null $permissionId = null)

Add group permission

Model|false
addPermission(integer $entityId, integer $userId, array $permissions, string $type = 'user', integer|null $permissionId = null)

Add permission

Model
addPublicPermission(integer $entityId, array $permissions)

Add public permission

Model|null
getPublicPermission(integer $entityId)

Get public permission

bool
deletePublicPermission(integer $entityId)

Delete public permissions

Model|null
getPermission(integer $entityId, integer $id, string $type = 'user')

Get permission model

Builder
getPermissionsQuery(int $entityId, string|null $type = null)

Get permissions query

Builder
scopePermissionsForUser(Builder $query, int $userId)

Query for all permissions for user

Builder
scopeUserPermissions(Builder $query)

Get user permissions query

Builder
scopeGroupPermissions(Builder $query)

Get group permissions query

Details

at line 25
Relation|null entity()

Get entity relation

Return Value

Relation|null

at line 35
Relation|null permission()

Get permission relation

Return Value

Relation|null

at line 45
string getNameAttribute()

Get permission name attribute

Return Value

string

Morphed models

Return Value

Relation|null

at line 69
bool deleteUserPermission(integer $entityId, integer $userId)

Delete user permission

Parameters

integer $entityId
integer $userId

Return Value

bool

at line 83
bool deleteGroupPermission(integer $entityId, integer $groupId)

Delete group permission

Parameters

integer $entityId
integer $groupId

Return Value

bool

at line 99
Model|false addUserPermission(integer $entityId, integer $userId, array $permissions, integer|null $permissionId = null)

Add user permission

Parameters

integer $entityId
integer $userId
array $permissions
integer|null $permissionId

Return Value

Model|false

at line 113
Model|false addGroupPermission(integer $entityId, integer $groupId, array $permissions, integer|null $permissionId = null)

Add group permission

Parameters

integer $entityId
integer $groupId
array $permissions
integer|null $permissionId

Return Value

Model|false

at line 128
Model|false addPermission(integer $entityId, integer $userId, array $permissions, string $type = 'user', integer|null $permissionId = null)

Add permission

Parameters

integer $entityId
integer $userId
array $permissions
string $type (user or gorup)
integer|null $permissionId

Return Value

Model|false

at line 151
Model addPublicPermission(integer $entityId, array $permissions)

Add public permission

Parameters

integer $entityId
array $permissions

Return Value

Model

at line 171
Model|null getPublicPermission(integer $entityId)

Get public permission

Parameters

integer $entityId

Return Value

Model|null

at line 187
bool deletePublicPermission(integer $entityId)

Delete public permissions

Parameters

integer $entityId

Return Value

bool

at line 202
Model|null getPermission(integer $entityId, integer $id, string $type = 'user')

Get permission model

Parameters

integer $entityId
integer $id
string $type

Return Value

Model|null

at line 219
Builder getPermissionsQuery(int $entityId, string|null $type = null)

Get permissions query

Parameters

int $entityId
string|null $type

Return Value

Builder

at line 236
Builder scopePermissionsForUser(Builder $query, int $userId)

Query for all permissions for user

Parameters

Builder $query
int $userId

Return Value

Builder

at line 263
Builder scopeUserPermissions(Builder $query)

Get user permissions query

Parameters

Builder $query

Return Value

Builder

at line 274
Builder scopeGroupPermissions(Builder $query)

Get group permissions query

Parameters

Builder $query

Return Value

Builder