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 | <p>Indicates if the model should be timestamped. Turn off by default.</p> | from AbstractModel |
|
protected callable[] | $afterSaveCallbacks | <p>An array of callbacks to be run once after the model is saved.</p> | from AbstractModel |
|
protected callable[] | $afterDeleteCallbacks | <p>An array of callbacks to be run once after the model is deleted.</p> | from AbstractModel |
|
static | $customRelations | from AbstractModel |
|
|
static | $customCasts | from AbstractModel |
|
|
static | $defaults | from AbstractModel |
|
|
protected | $tableAlias | <p>An alias for the table name, used in queries.</p> | from AbstractModel |
|
protected | $pendingEvents | from EventGeneratorTrait |
|
|
protected | $table |
|
||
protected | $casts |
|
||
protected string[] | $fillable | <p>The attributes that are mass assignable.</p> |
|
|
int | $user_id |
|
||
int | $discussion_id |
|
||
Carbon|null | $last_read_at |
|
||
int|null | $last_read_post_number |
|
||
Discussion | $discussion |
|
||
User | $user |
|
Methods
<p>Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.</p>
<p>Register a callback to be run once after the model is saved.</p>
<p>Register a callback to be run once after the model is deleted.</p>
<p>Mark the discussion as being read up to a certain point. Raises the DiscussionWasRead event.</p>
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 118
getAttribute($key)
<p>Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.</p>
in AbstractModel
at
line 143
protected mixed
getCustomRelation(string $name)
<p>Get a custom relation object.</p>
in AbstractModel
at
line 158
void
afterSave(callable $callback)
<p>Register a callback to be run once after the model is saved.</p>
in AbstractModel
at
line 166
void
afterDelete(callable $callback)
<p>Register a callback to be run once after the model is deleted.</p>
in AbstractModel
at
line 174
array
releaseAfterSaveCallbacks()
in AbstractModel
at
line 186
array
releaseAfterDeleteCallbacks()
in AbstractModel
at
line 195
__call($method, $parameters)
in AbstractModel
at
line 204
newModelQuery()
in AbstractModel
at
line 215
qualifyColumn($column)
in AbstractModel
at
line 224
mixed
withTableAlias(callable $callback)
in AbstractModel
at
line 236
Collection
newCollection(array $models = [])
in AbstractModel
at
line 241
__sleep()
in EventGeneratorTrait
at
line 16
void
raise(object $event)
in EventGeneratorTrait
at
line 24
array
releaseEvents()
<p>Return and reset all pending events.</p>
at
line 58
UserState
read(int $number)
<p>Mark the discussion as being read up to a certain point. Raises the DiscussionWasRead event.</p>
at
line 70
BelongsTo
discussion()
at
line 75
BelongsTo
user()
at
line 86
protected Builder
setKeysForSaveQuery(Builder $query)
<p>Set the keys for a save update query.</p>