Saved
extends Model
in package
implements
ActionEntity, HasPolicy
Uses
HasEntity, HasFactory, HasItemMorph, HasUserMorph, HasUserAsOwnerMorph, HasNestedAttributes
Class Saved.
Tags
Table of Contents
Interfaces
- ActionEntity
- Interface ActionEntity.
- HasPolicy
- Interface HasPolicy
Constants
- ENTITY_TYPE = 'saved'
Properties
- $collection_ids : array<string|int, mixed>
- $created_at : string
- $default_collection : SavedList|null
- $id : int
- $is_opened : int
- $item_id : int
- $item_type : string
- $nestedAttributes : array<string|int, string>
- $savedLists : Collection|BelongsToMany
- $updated_at : string
- $user_id : int
- $user_type : string
- $casts : array<string, string>
- $fillable : mixed
- $nestedAttributesFor : array<string|int, mixed>
- Defined nested attributes.
- $table : mixed
Methods
- entityId() : int
- entityType() : string
- factory() : SavedFactory
- fill() : static
- Fill the model with an array of attributes.
- getCollectionIdsAttribute() : array<string|int, mixed>
- getDefaultCollectionAttribute() : SavedList|null
- getItemAttribute() : mixed
- getItemTypeName() : string
- getNestedAttributesFor() : array<string|int, mixed>
- Get accept nested attributes.
- getUserAttribute() : mixed
- getUserEntityAttribute() : mixed
- isOpened() : bool
- isUser() : bool
- check if $user is the user (creator) of entity.
- item() : MorphTo|null
- itemId() : int
- itemType() : string
- moduleName() : string
- owner() : MorphTo
- ownerEntity() : BelongsTo
- ownerId() : int
- ownerType() : string
- save() : bool
- Save the model to the database.
- savedLists() : BelongsToMany
- syncHasManyRelationAttribute() : bool
- Save the hasMany nested relation attributes to the database.
- syncHasOneRelationAttribute() : bool
- user() : MorphTo
- userEntity() : BelongsTo
- userId() : int
- userType() : string
- allowDestroyNestedAttributes() : bool
- Check can we delete nested data.
- newFactory() : SavedFactory
Constants
ENTITY_TYPE
public
mixed
ENTITY_TYPE
= 'saved'
Properties
$collection_ids
public
array<string|int, mixed>
$collection_ids
$created_at
public
string
$created_at
$default_collection
public
SavedList|null
$default_collection
$id
public
int
$id
$is_opened
public
int
$is_opened
$item_id
public
int
$item_id
$item_type
public
string
$item_type
$nestedAttributes
public
array<string|int, string>
$nestedAttributes
= ['savedLists']
$savedLists
public
Collection|BelongsToMany
$savedLists
$updated_at
public
string
$updated_at
$user_id
public
int
$user_id
$user_type
public
string
$user_type
$casts
protected
array<string, string>
$casts
= ['is_opened' => 'boolean']
$fillable
protected
mixed
$fillable
= ['user_id', 'user_type', 'item_id', 'item_type', 'is_opened']
$nestedAttributesFor
Defined nested attributes.
protected
array<string|int, mixed>
$nestedAttributesFor
= []
$table
protected
mixed
$table
= 'saved_items'
Methods
entityId()
public
entityId() : int
Return values
intentityType()
public
entityType() : string
Return values
stringfactory()
public
static factory(mixed $parameters) : SavedFactory
Parameters
- $parameters : mixed
Return values
SavedFactoryfill()
Fill the model with an array of attributes.
public
fill(array<string|int, mixed> $attributes) : static
Parameters
- $attributes : array<string|int, mixed>
Tags
Return values
staticgetCollectionIdsAttribute()
public
getCollectionIdsAttribute() : array<string|int, mixed>
Return values
array<string|int, mixed>getDefaultCollectionAttribute()
public
getDefaultCollectionAttribute() : SavedList|null
Return values
SavedList|nullgetItemAttribute()
public
getItemAttribute() : mixed
getItemTypeName()
public
getItemTypeName() : string
Return values
stringgetNestedAttributesFor()
Get accept nested attributes.
public
getNestedAttributesFor() : array<string|int, mixed>
Return values
array<string|int, mixed>getUserAttribute()
public
getUserAttribute() : mixed
getUserEntityAttribute()
public
getUserEntityAttribute() : mixed
isOpened()
public
isOpened(User $context[, int|null $collectionId = null ]) : bool
Parameters
- $context : User
- $collectionId : int|null = null
Return values
boolisUser()
check if $user is the user (creator) of entity.
public
isUser(User $user) : bool
Parameters
- $user : User
Return values
boolitem()
public
item() : MorphTo|null
Return values
MorphTo|nullitemId()
public
itemId() : int
Return values
intitemType()
public
itemType() : string
Return values
stringmoduleName()
public
moduleName() : string
Return values
stringowner()
public
owner() : MorphTo
Return values
MorphToownerEntity()
public
ownerEntity() : BelongsTo
Return values
BelongsToownerId()
public
ownerId() : int
Return values
intownerType()
public
ownerType() : string
Return values
stringsave()
Save the model to the database.
public
save([array<string|int, mixed> $options = [] ]) : bool
Parameters
- $options : array<string|int, mixed> = []
Tags
Return values
boolsavedLists()
public
savedLists() : BelongsToMany
Return values
BelongsToManysyncHasManyRelationAttribute()
Save the hasMany nested relation attributes to the database.
public
syncHasManyRelationAttribute(HasMany $relation, array<string|int, mixed> $params) : bool
Parameters
- $relation : HasMany
- $params : array<string|int, mixed>
Return values
boolsyncHasOneRelationAttribute()
public
syncHasOneRelationAttribute(HasOne $relation, array<string|int, mixed> $params) : bool
Parameters
- $relation : HasOne
- $params : array<string|int, mixed>
Return values
booluser()
public
user() : MorphTo
Return values
MorphTouserEntity()
public
userEntity() : BelongsTo
Return values
BelongsTouserId()
public
userId() : int
Return values
intuserType()
public
userType() : string
Return values
stringallowDestroyNestedAttributes()
Check can we delete nested data.
protected
allowDestroyNestedAttributes(array<string|int, mixed> $params) : bool
Parameters
- $params : array<string|int, mixed>
Return values
boolnewFactory()
protected
static newFactory() : SavedFactory