UsersGroups
extends Model
in package
Uses
SoftDelete
Clake\Userextended\Models\UsersGroups
Tags
Table of Contents
- $attachMany : mixed
- $attachOne : mixed
- $belongsTo : mixed
- $belongsToMany : mixed
- $created_at : string|null
- $deleted_at : Carbon|null
- $hasMany : mixed
- $hasOne : array<string|int, mixed>
- $id : int
- $morphMany : mixed
- $morphOne : mixed
- $morphTo : mixed
- $role_id : int
- $table : string
- $timestamps : bool
- $updated_at : string|null
- $user_group_id : int
- $user_id : int
- $dates : array<string|int, mixed>
- $fillable : array<string|int, mixed>
- $forceDeleting : bool
- Indicates if the model is currently force deleting.
- $guarded : array<string|int, mixed>
- addUser() : bool
- Adds a relation row to users groups.
- all() :
- bootSoftDelete() : void
- Boot the soft deleting trait for a model.
- byGroup() :
- byRole() :
- byUser() :
- byUsersWithoutRole() :
- forceDelete() : void
- Force a hard delete on a soft deleted model.
- get() :
- getAssignedGroups() : mixed
- Returns a list of groups with users attached to them TODO
- getAssignedRoles() : mixed
- Returns a list of roles with users attached to them TODO
- getDeletedAtColumn() : string
- Get the name of the "deleted at" column.
- getQualifiedDeletedAtColumn() : string
- Get the fully qualified "deleted at" column.
- isSoftDelete() : bool
- Helper method to check if the model is currently being hard or soft deleted, useful in events.
- newModelQuery() :
- newQuery() :
- onlyTrashed() : Builder|static
- Get a new query builder that only includes soft deletes.
- query() :
- removeUser() : bool
- Remove a user from a group
- restore() : bool|null
- Restore a soft-deleted model instance.
- restored() : void
- Register a restored model event with the dispatcher.
- restoring() : void
- Register a restoring model event with the dispatcher.
- scopeByGroup() : mixed
- Returns a group based upon the passed in groupCode
- scopeByRole() : mixed
- Returns a role based upon the passed in roleCode
- scopeByUser() : mixed
- Returns a user based upon the passed in userId
- scopeByUsersWithoutRole() : mixed
- Scope a list of rows of users in a group but without an assigned role.
- trashed() : bool
- Determine if the model instance has been soft-deleted.
- whereCreatedAt() :
- whereDeletedAt() :
- whereId() :
- whereRoleId() :
- whereUpdatedAt() :
- whereUserGroupId() :
- whereUserId() :
- withTrashed() : Builder|static
- Get a new query builder that includes soft deletes.
- performDeleteOnModel() : mixed
- Perform the actual delete query on this model instance.
- performRestoreOnRelations() : void
- Locates relations with softDelete flag and cascades the restore event.
- performSoftDeleteOnRelations() : void
- Locates relations with softDelete flag and cascades the delete event.
- runSoftDelete() : void
- Perform the actual delete query on this model instance.
Properties
$attachMany
public
mixed
$attachMany
= []
$attachOne
public
mixed
$attachOne
= []
$belongsTo
public
mixed
$belongsTo
= ['role' => ['Clake\UserExtended\Models\Role', 'key' => 'role_id'], 'user' => ['Clake\UserExtended\Models\UserExtended', 'key' => 'user_id'], 'group' => ['Clake\UserExtended\Models\GroupsExtended', 'key' => 'user_group_id']]
$belongsToMany
public
mixed
$belongsToMany
= []
$created_at
public
string|null
$created_at
$deleted_at
public
Carbon|null
$deleted_at
$hasMany
public
mixed
$hasMany
= []
$hasOne
public
array<string|int, mixed>
$hasOne
= []
Relations
$id
public
int
$id
$morphMany
public
mixed
$morphMany
= []
$morphOne
public
mixed
$morphOne
= []
$morphTo
public
mixed
$morphTo
= []
$role_id
public
int
$role_id
$table
public
string
$table
= 'users_groups'
The database table used by the model.
$timestamps
public
bool
$timestamps
= false
$updated_at
public
string|null
$updated_at
$user_group_id
public
int
$user_group_id
$user_id
public
int
$user_id
$dates
protected
array<string|int, mixed>
$dates
= ['deleted_at']
$fillable
protected
array<string|int, mixed>
$fillable
= []
Fillable fields
$forceDeleting
Indicates if the model is currently force deleting.
protected
bool
$forceDeleting
= false
$guarded
protected
array<string|int, mixed>
$guarded
= ['*']
Guarded fields
Methods
addUser()
Adds a relation row to users groups.
public
static addUser( $userObj, $groupId, int $roleId) : bool
Parameters
Return values
bool —all()
public
static all(mixed $columns) :
Parameters
- $columns : mixed
Return values
—bootSoftDelete()
Boot the soft deleting trait for a model.
public
static bootSoftDelete() : void
Return values
void —byGroup()
public
static byGroup(mixed $groupCode) :
Parameters
- $groupCode : mixed
Return values
—byRole()
public
static byRole(mixed $roleCode) :
Parameters
- $roleCode : mixed
Return values
—byUser()
public
static byUser(mixed $userId) :
Parameters
- $userId : mixed
Return values
—byUsersWithoutRole()
public
static byUsersWithoutRole(mixed $groupCode) :
Parameters
- $groupCode : mixed
Return values
—forceDelete()
Force a hard delete on a soft deleted model.
public
forceDelete() : void
Return values
void —get()
public
static get(mixed $columns) :
Parameters
- $columns : mixed
Return values
—getAssignedGroups()
Returns a list of groups with users attached to them TODO
public
static getAssignedGroups() : mixed
Return values
mixed —getAssignedRoles()
Returns a list of roles with users attached to them TODO
public
static getAssignedRoles() : mixed
Return values
mixed —getDeletedAtColumn()
Get the name of the "deleted at" column.
public
getDeletedAtColumn() : string
Return values
string —getQualifiedDeletedAtColumn()
Get the fully qualified "deleted at" column.
public
getQualifiedDeletedAtColumn() : string
Return values
string —isSoftDelete()
Helper method to check if the model is currently being hard or soft deleted, useful in events.
public
isSoftDelete() : bool
Return values
bool —newModelQuery()
public
static newModelQuery() :
Return values
—newQuery()
public
static newQuery() :
Return values
—onlyTrashed()
Get a new query builder that only includes soft deletes.
public
static onlyTrashed() : Builder|static
Return values
Builder|static —query()
public
static query() :
Return values
—removeUser()
Remove a user from a group
public
static removeUser( $userObj, $groupId) : bool
Parameters
Return values
bool —restore()
Restore a soft-deleted model instance.
public
restore() : bool|null
Return values
bool|null —restored()
Register a restored model event with the dispatcher.
public
static restored(Closure|string $callback) : void
Parameters
- $callback : Closure|string
Return values
void —restoring()
Register a restoring model event with the dispatcher.
public
static restoring(Closure|string $callback) : void
Parameters
- $callback : Closure|string
Return values
void —scopeByGroup()
Returns a group based upon the passed in groupCode
public
scopeByGroup( $query, $groupCode) : mixed
Parameters
Return values
mixed —scopeByRole()
Returns a role based upon the passed in roleCode
public
scopeByRole( $query, $roleCode) : mixed
Parameters
Return values
mixed —scopeByUser()
Returns a user based upon the passed in userId
public
scopeByUser( $query, $userId) : mixed
Parameters
Return values
mixed —scopeByUsersWithoutRole()
Scope a list of rows of users in a group but without an assigned role.
public
scopeByUsersWithoutRole( $query, $groupCode) : mixed
Parameters
Return values
mixed —trashed()
Determine if the model instance has been soft-deleted.
public
trashed() : bool
Return values
bool —whereCreatedAt()
public
static whereCreatedAt(mixed $value) :
Parameters
- $value : mixed
Return values
—whereDeletedAt()
public
static whereDeletedAt(mixed $value) :
Parameters
- $value : mixed
Return values
—whereId()
public
static whereId(mixed $value) :
Parameters
- $value : mixed
Return values
—whereRoleId()
public
static whereRoleId(mixed $value) :
Parameters
- $value : mixed
Return values
—whereUpdatedAt()
public
static whereUpdatedAt(mixed $value) :
Parameters
- $value : mixed
Return values
—whereUserGroupId()
public
static whereUserGroupId(mixed $value) :
Parameters
- $value : mixed
Return values
—whereUserId()
public
static whereUserId(mixed $value) :
Parameters
- $value : mixed
Return values
—withTrashed()
Get a new query builder that includes soft deletes.
public
static withTrashed() : Builder|static
Return values
Builder|static —performDeleteOnModel()
Perform the actual delete query on this model instance.
protected
performDeleteOnModel() : mixed
Return values
mixed —performRestoreOnRelations()
Locates relations with softDelete flag and cascades the restore event.
protected
performRestoreOnRelations() : void
Return values
void —performSoftDeleteOnRelations()
Locates relations with softDelete flag and cascades the delete event.
protected
performSoftDeleteOnRelations() : void
Return values
void —runSoftDelete()
Perform the actual delete query on this model instance.
protected
runSoftDelete() : void