class Group extends AbstractModel
Traits
Constants
| ADMINISTRATOR_ID |
The ID of the administrator group. |
| GUEST_ID |
The ID of the guest group. |
| MEMBER_ID |
The ID of the member group. |
| MODERATOR_ID |
The ID of the mod group. |
Properties
| bool | $timestamps | Indicates if the model should be timestamped. Turn off by default. | from AbstractModel |
|
| protected callable[] | $afterSaveCallbacks | An array of callbacks to be run once after the model is saved. | from AbstractModel |
|
| protected callable[] | $afterDeleteCallbacks | An array of callbacks to be run once after the model is deleted. | from AbstractModel |
|
| static | $customRelations | from AbstractModel |
|
|
| static | $customCasts | from AbstractModel |
|
|
| static | $defaults | from AbstractModel |
|
|
| protected string|null | $tableAlias | An alias for the table name, used in queries. | from AbstractModel |
|
| int | $id |
|
||
| protected array | $pendingEvents | from EventGeneratorTrait |
|
|
| static protected | $visibilityScopers | from ScopeVisibilityTrait |
|
|
| protected array | $dates | The attributes that should be mutated to dates. |
|
|
| string | $name_singular |
|
||
| string | $name_plural |
|
||
| string|null | $color |
|
||
| string|null | $icon |
|
||
| $is_hidden |
|
|||
| Collection | $users |
|
||
| Collection | $permissions |
|
Methods
Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.
Register a callback to be run once after the model is saved.
Register a callback to be run once after the model is deleted.
Scope a query to only include records that are visible to a user.
Details
at
line 67
static
boot()
Boot the model.
in AbstractModel
at
line 97
__construct(array $attributes = [])
{@inheritdoc}
in AbstractModel
at
line 115
getCasts()
{@inheritdoc}
in AbstractModel
at
line 133
mixed
getAttribute(string $key)
Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.
in AbstractModel
at
line 159
protected mixed
getCustomRelation(string $name)
Get a custom relation object.
in AbstractModel
at
line 175
void
afterSave(callable $callback)
Register a callback to be run once after the model is saved.
in AbstractModel
at
line 186
void
afterDelete(callable $callback)
Register a callback to be run once after the model is deleted.
in AbstractModel
at
line 194
callable[]
releaseAfterSaveCallbacks()
in AbstractModel
at
line 206
callable[]
releaseAfterDeleteCallbacks()
in AbstractModel
at
line 218
__call($method, $arguments)
{@inheritdoc}
in AbstractModel
at
line 227
newModelQuery()
in AbstractModel
at
line 238
qualifyColumn($column)
in AbstractModel
at
line 247
withTableAlias(callable $callback)
in AbstractModel
at
line 262
newCollection( Collection|array $models = [])
in EventGeneratorTrait
at
line 24
raise(mixed $event)
Raise a new event.
in EventGeneratorTrait
at
line 34
array
releaseEvents()
Return and reset all pending events.
in ScopeVisibilityTrait
at
line 20
static
registerVisibilityScoper($scoper, $ability = null)
in ScopeVisibilityTrait
at
line 41
scopeWhereVisibleTo( Builder $query, User $actor, string $ability = 'view')
Scope a query to only include records that are visible to a user.
at
line 86
static Group
build(string $nameSingular, string $namePlural, string $color = null, string $icon = null, bool $isHidden = false)
Create a new group.
at
line 108
$this
rename(string $nameSingular, string $namePlural)
Rename the group.
at
line 123
BelongsToMany
users()
Define the relationship with the group's users.
at
line 144
bool
hasPermission(string $permission)
Check whether the group has a certain permission.