class Group extends AbstractModel

Traits

Constants

ADMINISTRATOR_ID

GUEST_ID

MEMBER_ID

MODERATOR_ID

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 $tableAlias <p>An alias for the table name, used in queries.</p> from AbstractModel
protected $pendingEvents from EventGeneratorTrait
static protected $visibilityScopers from ScopeVisibilityTrait
protected $casts
int $id
string $name_singular
string $name_plural
string|null $color
string|null $icon
bool $is_hidden
Collection $users
Collection $permissions

Methods

static 
boot()

No description

__construct(array $attributes = [])

No description

array
getCasts()

No description

getAttribute($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>

array
releaseAfterSaveCallbacks()

No description

array
releaseAfterDeleteCallbacks()

No description

__call($method, $parameters)

No description

newModelQuery()

No description

qualifyColumn($column)

No description

mixed
withTableAlias(callable $callback)

No description

newCollection(array $models = [])

No description

__sleep()

No description

void
raise(object $event)

No description

array
releaseEvents()

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

static void
registerVisibilityScoper(callable $scoper, string|null $ability = null)

No description

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

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

static Builder
whereVisibleTo(User $user)

No description

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

No description

rename(string $nameSingular, string $namePlural)

No description

BelongsToMany
users()

No description

HasMany
permissions()

No description

bool
hasPermission(string $permission)

No description

Details

static boot()

__construct(array $attributes = [])

Parameters

array $attributes

array getCasts()

Return Value

array

getAttribute($key)

<p>Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.</p>

Parameters

$key

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

array releaseAfterSaveCallbacks()

Return Value

array

array releaseAfterDeleteCallbacks()

Return Value

array

__call($method, $parameters)

Parameters

$method
$parameters

newModelQuery()

qualifyColumn($column)

Parameters

$column

mixed withTableAlias(callable $callback)

Parameters

callable $callback

Return Value

mixed

Collection newCollection(array $models = [])

Parameters

array $models

Return Value

Collection

__sleep()

void raise(object $event)

Parameters

object $event

Return Value

void

array releaseEvents()

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

Return Value

array

static void registerVisibilityScoper(callable $scoper, string|null $ability = null)

Parameters

callable $scoper
string|null $ability

Return Value

void

Builder 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

Return Value

Builder

static Builder whereVisibleTo(User $user)

Parameters

User $user

Return Value

Builder

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

Parameters

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

Return Value

Group

Group rename(string $nameSingular, string $namePlural)

Parameters

string $nameSingular
string $namePlural

Return Value

Group

BelongsToMany users()

Return Value

BelongsToMany

HasMany permissions()

Return Value

HasMany

bool hasPermission(string $permission)

Parameters

string $permission

Return Value

bool