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