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
bool $is_hidden
Collection $users
Collection $permissions

Methods

static 
boot()

<p>Boot the model.</p>

__construct(array $attributes = [])

<p>{@inheritdoc}</p>

getCasts()

<p>{@inheritdoc}</p>

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>

mixed
getCustomRelation(string $name)

<p>Get a custom relation object.</p>

void
afterSave(callable $callback)

<p>Register a callback to be run once after the model is saved.</p>

void
afterDelete(callable $callback)

<p>Register a callback to be run once after the model is deleted.</p>

callable[]
releaseAfterSaveCallbacks()

No description

callable[]
releaseAfterDeleteCallbacks()

No description

__call($method, $arguments)

<p>{@inheritdoc}</p>

newModelQuery()

No description

qualifyColumn($column)

No description

withTableAlias(callable $callback)

No description

newCollection(Collection|array $models = [])

No description

raise(mixed $event)

<p>Raise a new event.</p>

array
releaseEvents()

<p>Return and reset all pending events.</p>

static 
registerVisibilityScoper($scoper, $ability = null)

No description

scopeWhereVisibleTo(Builder $query, User $actor, string $ability = 'view')

<p>Scope a query to only include records that are visible to a user.</p>

static Group
build(string $nameSingular, string $namePlural, string $color = null, string $icon = null, bool $isHidden = false)

<p>Create a new group.</p>

$this
rename(string $nameSingular, string $namePlural)

<p>Rename the group.</p>

BelongsToMany
users()

<p>Define the relationship with the group's users.</p>

HasMany
permissions()

<p>Define the relationship with the group's permissions.</p>

bool
hasPermission(string $permission)

<p>Check whether the group has a certain permission.</p>

Details

static boot()

<p>Boot the model.</p>

__construct(array $attributes = [])

<p>{@inheritdoc}</p>

Parameters

array $attributes

getCasts()

<p>{@inheritdoc}</p>

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>

Parameters

string $key

Return Value

mixed

protected mixed getCustomRelation(string $name)

<p>Get a custom relation object.</p>

Parameters

string $name

Return Value

mixed

void afterSave(callable $callback)

<p>Register a callback to be run once after the model is saved.</p>

Parameters

callable $callback

Return Value

void

void afterDelete(callable $callback)

<p>Register a callback to be run once after the model is deleted.</p>

Parameters

callable $callback

Return Value

void

callable[] releaseAfterSaveCallbacks()

Return Value

callable[]

callable[] releaseAfterDeleteCallbacks()

Return Value

callable[]

__call($method, $arguments)

<p>{@inheritdoc}</p>

Parameters

$method
$arguments

newModelQuery()

qualifyColumn($column)

Parameters

$column

withTableAlias(callable $callback)

Parameters

callable $callback

newCollection(Collection|array $models = [])

Parameters

Collection|array $models

raise(mixed $event)

<p>Raise a new event.</p>

Parameters

mixed $event

array releaseEvents()

<p>Return and reset all pending events.</p>

Return Value

array

static registerVisibilityScoper($scoper, $ability = null)

Parameters

$scoper
$ability

scopeWhereVisibleTo(Builder $query, User $actor, string $ability = 'view')

<p>Scope a query to only include records that are visible to a user.</p>

Parameters

Builder $query
User $actor
string $ability

static Group build(string $nameSingular, string $namePlural, string $color = null, string $icon = null, bool $isHidden = false)

<p>Create a new group.</p>

Parameters

string $nameSingular
string $namePlural
string $color
string $icon
bool $isHidden

Return Value

Group

$this rename(string $nameSingular, string $namePlural)

<p>Rename the group.</p>

Parameters

string $nameSingular
string $namePlural

Return Value

$this

BelongsToMany users()

<p>Define the relationship with the group's users.</p>

Return Value

BelongsToMany

HasMany permissions()

<p>Define the relationship with the group's permissions.</p>

Return Value

HasMany

bool hasPermission(string $permission)

<p>Check whether the group has a certain permission.</p>

Parameters

string $permission

Return Value

bool