class UserState extends AbstractModel
Models a discussion-user state record in the database.
Stores information about how much of a discussion a user has read. Can also be used to store other information, if the appropriate columns are added to the database, like a user's subscription status for a discussion.
Traits
Properties
| bool | $timestamps | Indicates if the model should be timestamped. Turn off by default. | from AbstractModel |
|
| protected callable[] | $afterSaveCallbacks | An array of callbacks to be run once after the model is saved. | from AbstractModel |
|
| protected callable[] | $afterDeleteCallbacks | An array of callbacks to be run once after the model is deleted. | from AbstractModel |
|
| static array | $customCasts | from AbstractModel |
|
|
| static array | $defaults | from AbstractModel |
|
|
| protected string|null | $tableAlias | An alias for the table name, used in queries. | from AbstractModel |
|
| string[]|null | $uniqueKeys | If a model has unique keys, they should be defined here. | from AbstractModel |
|
| protected array | $pendingEvents | from EventGeneratorTrait |
|
|
| protected | $table |
|
||
| protected | $casts |
|
||
| $incrementing |
|
|||
| protected | $fillable | The attributes that are mass assignable. |
|
|
| int | $user_id |
|
||
| int | $discussion_id |
|
||
| Carbon|null | $last_read_at |
|
||
| int|null | $last_read_post_number |
|
||
| Discussion | $discussion |
|
||
| User | $user |
|
Methods
Register a callback to be run once after the model is saved.
Register a callback to be run once after the model is deleted.
Mark the discussion as being read up to a certain point. Raises the DiscussionWasRead event.
Details
in AbstractModel
at
line 71
static
boot()
in AbstractModel
at
line 88
__construct(array $attributes = [])
in AbstractModel
at
line 103
array
getCasts()
in AbstractModel
at
line 117
void
afterSave(callable $callback)
Register a callback to be run once after the model is saved.
in AbstractModel
at
line 125
void
afterDelete(callable $callback)
Register a callback to be run once after the model is deleted.
in AbstractModel
at
line 133
array
releaseAfterSaveCallbacks()
in AbstractModel
at
line 145
array
releaseAfterDeleteCallbacks()
in AbstractModel
at
line 157
newModelQuery()
in AbstractModel
at
line 169
qualifyColumn($column)
in AbstractModel
at
line 178
mixed
withTableAlias(callable $callback)
in AbstractModel
at
line 191
Collection
newCollection(array $models = [])
in AbstractModel
at
line 197
__sleep()
in EventGeneratorTrait
at
line 16
void
raise(object $event)
in EventGeneratorTrait
at
line 24
array
releaseEvents()
Return and reset all pending events.
at
line 58
UserState
read(int $number)
Mark the discussion as being read up to a certain point. Raises the DiscussionWasRead event.
at
line 70
BelongsTo
discussion()
at
line 75
BelongsTo
user()
at
line 86
protected Builder
setKeysForSaveQuery(Builder $query)
Set the keys for a save update query.