MetaFox

Saved extends Model
in package
implements ActionEntity, HasPolicy Uses HasEntity, HasFactory, HasItemMorph, HasUserMorph, HasUserAsOwnerMorph, HasNestedAttributes

Class Saved.

Tags
mixin

Builder

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

$is_opened

public int $is_opened

$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_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
int

entityType()

public entityType() : string
Return values
string

factory()

public static factory(mixed $parameters) : SavedFactory
Parameters
$parameters : mixed
Return values
SavedFactory

fill()

Fill the model with an array of attributes.

public fill(array<string|int, mixed> $attributes) : static
Parameters
$attributes : array<string|int, mixed>
Tags
throws
MassAssignmentException
Return values
static

getCollectionIdsAttribute()

public getCollectionIdsAttribute() : array<string|int, mixed>
Return values
array<string|int, mixed>

getItemTypeName()

public getItemTypeName() : string
Return values
string

getNestedAttributesFor()

Get accept nested attributes.

public getNestedAttributesFor() : array<string|int, mixed>
Return values
array<string|int, mixed>

getUserEntityAttribute()

public getUserEntityAttribute() : mixed

isOpened()

public isOpened(User $context[, int|null $collectionId = null ]) : bool
Parameters
$context : User
$collectionId : int|null = null
Return values
bool

isUser()

check if $user is the user (creator) of entity.

public isUser(User $user) : bool
Parameters
$user : User
Return values
bool

item()

public item() : MorphTo|null
Return values
MorphTo|null

itemType()

public itemType() : string
Return values
string

moduleName()

public moduleName() : string
Return values
string

save()

Save the model to the database.

public save([array<string|int, mixed> $options = [] ]) : bool
Parameters
$options : array<string|int, mixed> = []
Tags
throws
Exception
Return values
bool

savedLists()

public savedLists() : BelongsToMany
Return values
BelongsToMany

syncHasManyRelationAttribute()

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
bool

syncHasOneRelationAttribute()

public syncHasOneRelationAttribute(HasOne $relation, array<string|int, mixed> $params) : bool
Parameters
$relation : HasOne
$params : array<string|int, mixed>
Return values
bool

userEntity()

public userEntity() : BelongsTo
Return values
BelongsTo

userType()

public userType() : string
Return values
string

allowDestroyNestedAttributes()

Check can we delete nested data.

protected allowDestroyNestedAttributes(array<string|int, mixed> $params) : bool
Parameters
$params : array<string|int, mixed>
Return values
bool

newFactory()

protected static newFactory() : SavedFactory
Return values
SavedFactory

        
On this page

Search results