trait HasUserState (View source)

Methods to give a model per-user state.

Methods

HasOne
userState(User $user = null)

Relationship with the state record for a user.

loadUserState(User $user)

Load the userState relationship for the given user.

Details

HasOne userState(User $user = null)

Relationship with the state record for a user.

Defaults to the current user when no user is specified, as is the case when eager-loading the relationship.

The model representing the user state table is derived by appending User to the parent model name (eg. PostUser). Alternatively, it can be specified by setting the userStateModel property.

Parameters

User $user

Return Value

HasOne

HasUserState loadUserState(User $user)

Load the userState relationship for the given user.

Parameters

User $user

Return Value

HasUserState