class Group extends Model implements TwillModelContract (View source)

Traits

Properties

$translatedAttributes from  IsTranslatable
$timestamps
protected $fillable
$checkboxes
protected $casts

Methods

BelongsToMany
permissions()

This method should be clean of checks, the checks should happen earlier on.

void
grantGlobalPermission(string $name)

Add global permission to item, after making sure the permission is valid

void
revokeGlobalPermission(string $name)

Revoke global permission from the item, after making sure the permission is valid

void
grantModulePermission(string $name, string|object $permissionableType)

Add module permission to item, after making sure the permission is valid

void
revokeModulePermission(string $name, string|object $permissionableType)

Revoke module permission from the item, after making sure the permission is valid

void
revokeAllModulePermission(string|object $permissionableType)

Revoke all module permissions from the item

void
grantModuleItemPermission(string $name, object $permissionableItem)

Add module item permission, after making sure the permission is valid

void
revokeModuleItemPermission(string $name, object $permissionableItem)

Revoke module item permissions, after making sure the permission is valid

void
revokeModuleItemAllPermissions(object $permissionableItem)

Revoke all module item permissions

void
revokeAllPermissions()

Revoke all permissions

void
removePermissions(int[] $permissionableIds)

Revoke all permissions from a list of permission ids

void
checkPermissionAvailable(string $name, string $scope)

Check if a permission is available for a particular scope

bool
isTranslatable(null|array|string $columns = null)

Checks if this model is translatable.

static Group
getEveryoneGroup()

Return the Everyone group.

string
getTitleInBrowserAttribute()

Return the group title.

Builder
scopePublished(Builder $query)

No description

Builder
scopeDraft(Builder $query)

No description

Builder
scopeOnlyTrashed(Builder $query)

No description

BelongsToMany
users()

No description

bool
isEveryoneGroup()

Check if current group is the Everyone group.

string
getCreatedAtAttribute($value)

Return the formatted created date.

bool
getCanEditAttribute()

Check if the group can be edited (not a system group, ie. Everyone).

bool
getCanPublishAttribute()

Check if the group can be published (not a system group, ie. Everyone).

string
getUsersCountAttribute()

Return the formatted number of users in this group.

Collection
viewableItems()

Return viewable items.

array
permissionableIds()

Return ids of permissionable items.

Collection
permissionableItems()

Return permissionable items.

Builder
scopeAccessible(Builder $query)

No description

array
getTranslatedAttributes()

No description

Details

BelongsToMany permissions()

This method should be clean of checks, the checks should happen earlier on.

Return Value

BelongsToMany

void grantGlobalPermission(string $name)

Add global permission to item, after making sure the permission is valid

Parameters

string $name

Return Value

void

void revokeGlobalPermission(string $name)

Revoke global permission from the item, after making sure the permission is valid

Parameters

string $name

Return Value

void

void grantModulePermission(string $name, string|object $permissionableType)

Add module permission to item, after making sure the permission is valid

Parameters

string $name
string|object $permissionableType

Return Value

void

void revokeModulePermission(string $name, string|object $permissionableType)

Revoke module permission from the item, after making sure the permission is valid

Parameters

string $name
string|object $permissionableType

Return Value

void

void revokeAllModulePermission(string|object $permissionableType)

Revoke all module permissions from the item

Parameters

string|object $permissionableType

Return Value

void

void grantModuleItemPermission(string $name, object $permissionableItem)

Add module item permission, after making sure the permission is valid

Parameters

string $name
object $permissionableItem

Return Value

void

void revokeModuleItemPermission(string $name, object $permissionableItem)

Revoke module item permissions, after making sure the permission is valid

Parameters

string $name
object $permissionableItem

Return Value

void

void revokeModuleItemAllPermissions(object $permissionableItem)

Revoke all module item permissions

Parameters

object $permissionableItem

Return Value

void

void revokeAllPermissions()

Revoke all permissions

Return Value

void

void removePermissions(int[] $permissionableIds)

Revoke all permissions from a list of permission ids

Parameters

int[] $permissionableIds

Return Value

void

protected void checkPermissionAvailable(string $name, string $scope)

Check if a permission is available for a particular scope

Parameters

string $name
string $scope

Return Value

void

See also

Permission::SCOPE_GLOBAL
Permission::SCOPE_MODULE
Permission::SCOPE_ITEM

bool isTranslatable(null|array|string $columns = null)

Checks if this model is translatable.

If no columns/column is provided it will return true if the model itself is translatable.

Parameters

null|array|string $columns

Return Value

bool

static Group getEveryoneGroup()

Return the Everyone group.

Return Value

Group

string getTitleInBrowserAttribute()

Return the group title.

Return Value

string

Builder scopePublished(Builder $query)

No description

Parameters

Builder $query

Return Value

Builder

Builder scopeDraft(Builder $query)

No description

Parameters

Builder $query

Return Value

Builder

Builder scopeOnlyTrashed(Builder $query)

No description

Parameters

Builder $query

Return Value

Builder

BelongsToMany users()

No description

Return Value

BelongsToMany

bool isEveryoneGroup()

Check if current group is the Everyone group.

Return Value

bool

string getCreatedAtAttribute($value)

Return the formatted created date.

Parameters

$value

Return Value

string

bool getCanEditAttribute()

Check if the group can be edited (not a system group, ie. Everyone).

Return Value

bool

bool getCanPublishAttribute()

Check if the group can be published (not a system group, ie. Everyone).

Return Value

bool

string getUsersCountAttribute()

Return the formatted number of users in this group.

Return Value

string

Collection viewableItems()

Return viewable items.

Return Value

Collection

array permissionableIds()

Return ids of permissionable items.

Return Value

array

Collection permissionableItems()

Return permissionable items.

Return Value

Collection

Builder scopeAccessible(Builder $query)

No description

Parameters

Builder $query

Return Value

Builder

array getTranslatedAttributes()

No description

Return Value

array