Role
class Role extends Model implements Sortable, TwillModelContract (View source)
Traits
Properties
protected | $cropParamsKeys | from HasMedias | |
$translatedAttributes | from IsTranslatable | ||
$timestamps | |||
protected | $fillable | ||
$checkboxes | |||
protected | $casts |
Methods
Checks if an image has been attached for a role and crop.
Returns the URL of the attached image for a role and crop.
Returns an array of URLs of all attached images for a role and crop.
Returns an array of URLs of all attached images for a role, including all crops.
Returns an array of meta information for the image attached for a role and crop.
Returns an array of meta information for all images attached for a role and crop.
Returns an array of meta information for all images attached for a role, including all crops.
Returns the alt text of the image attached for a role.
Returns the caption of the image attached for a role.
Returns the video URL of the image attached for a role.
Returns the media object attached for a role and crop.
Returns the LQIP base64 encoded string for a role.
Returns the URL of the social image for a role and crop.
Returns the URL of the CMS image for a role and crop.
Returns the URL of the default CMS image for this model.
Returns the media objects associated with a role and crop.
This method should be clean of checks, the checks should happen earlier on.
Add global permission to item, after making sure the permission is valid
Revoke global permission from the item, after making sure the permission is valid
Add module permission to item, after making sure the permission is valid
Revoke module permission from the item, after making sure the permission is valid
Revoke all module permissions from the item
Add module item permission, after making sure the permission is valid
Revoke module item permissions, after making sure the permission is valid
Revoke all module item permissions
Revoke all permissions from a list of permission ids
Check if a permission is available for a particular scope
Checks if this model is translatable.
No description
No description
No description
No description
No description
No description
No description
Return the formatted number of users in this group
Return the roles that are considered accessible for this role
No description
Details
array
getMediasParams()
No description
static void
bootHasMedias()
No description
MorphToMany
medias()
Defines the many-to-many relationship for media objects.
bool
hasImage(string $role, string $crop = 'default')
Checks if an image has been attached for a role and crop.
string|null
image(string $role, string $crop = 'default', array $params = [], bool $has_fallback = false, bool $cms = false, Media|null|bool $media = null)
Returns the URL of the attached image for a role and crop.
array
images(string $role, string $crop = 'default', array $params = [])
Returns an array of URLs of all attached images for a role and crop.
array
imagesWithCrops(string $role, array $params = [])
Returns an array of URLs of all attached images for a role, including all crops.
array
imageAsArray(string $role, string $crop = 'default', array $params = [], Media|null $media = null)
Returns an array of meta information for the image attached for a role and crop.
array
imagesAsArrays(string $role, string $crop = 'default', array $params = [])
Returns an array of meta information for all images attached for a role and crop.
array
imagesAsArraysWithCrops(string $role, array $params = [])
Returns an array of meta information for all images attached for a role, including all crops.
string
imageAltText(string $role, Media|null $media = null)
Returns the alt text of the image attached for a role.
string
imageCaption(string $role, Media|null $media = null)
Returns the caption of the image attached for a role.
string
imageVideo(string $role, Media|null $media = null)
Returns the video URL of the image attached for a role.
Media|null
imageObject(string $role, string $crop = 'default')
Returns the media object attached for a role and crop.
string|null
lowQualityImagePlaceholder(string $role, string $crop = 'default', array $params = [], bool $has_fallback = false)
Returns the LQIP base64 encoded string for a role.
Use this in conjunction with the RefreshLQIP
Artisan command.
string|null
socialImage(string $role, string $crop = 'default', array $params = [], bool $has_fallback = false)
Returns the URL of the social image for a role and crop.
string
cmsImage(string $role, string $crop = 'default', array $params = [])
Returns the URL of the CMS image for a role and crop.
string
defaultCmsImage(array $params = [])
Returns the URL of the default CMS image for this model.
Collection
imageObjects(string $role, string $crop = 'default')
Returns the media objects associated with a role and crop.
BelongsToMany
permissions()
This method should be clean of checks, the checks should happen earlier on.
void
grantGlobalPermission(string $name)
Add global permission to item, after making sure the permission is valid
void
revokeGlobalPermission(string $name)
Revoke global permission from the item, after making sure the permission is valid
void
grantModulePermission(string $name, string|object $permissionableType)
Add module permission to item, after making sure the permission is valid
void
revokeModulePermission(string $name, string|object $permissionableType)
Revoke module permission from the item, after making sure the permission is valid
void
revokeAllModulePermission(string|object $permissionableType)
Revoke all module permissions from the item
void
grantModuleItemPermission(string $name, object $permissionableItem)
Add module item permission, after making sure the permission is valid
void
revokeModuleItemPermission(string $name, object $permissionableItem)
Revoke module item permissions, after making sure the permission is valid
void
revokeModuleItemAllPermissions(object $permissionableItem)
Revoke all module item permissions
void
revokeAllPermissions()
Revoke all permissions
void
removePermissions(int[] $permissionableIds)
Revoke all permissions from a list of permission ids
protected void
checkPermissionAvailable(string $name, string $scope)
Check if a permission is available for a particular scope
bool
isTranslatable(null|array|string $columns = null)
Checks if this model is translatable.
If no columns/column is provided it will return true if the model itself is translatable.
static protected
bootHasPosition()
No description
protected
setToLastPosition()
No description
protected
getCurrentLastPosition()
No description
Builder
scopeOrdered(Builder $query)
No description
static void
setNewOrder(array $ids, int $startOrder = 1)
No description
__construct(array $attributes = [])
No description
Builder
scopeAccessible(Builder $query)
No description
Builder
scopePublished(Builder $query)
No description
Builder
scopeDraft(Builder $query)
No description
Builder
scopeOnlyTrashed(Builder $query)
No description
HasMany
users()
No description
string
getCreatedAtAttribute($value)
No description
string
getUsersCountAttribute($value)
Return the formatted number of users in this group
Collection
getAccessibleRolesAttribute()
Return the roles that are considered accessible for this role
array
getTranslatedAttributes()
No description