Followable
trait Followable (View source)
Methods to make a model "followable" per user.
A followable model can be "followed" or "ignored" by each user, which will
determine how they see and are notified about activity in the model. The
model must have user state (see HasUserState
) with notification
and
followed_at
columns to store this state.
Properties
Collection read-only | $followedBy | ||
Collection read-only | $ignoredBy |
Methods
Relationship with all users who are following this model.
Relationship with all users who are ignoring this model.
Find only models that the current user is following.
Find only models that the current user is ignoring.
Save the current user's notification preference for this model.
Follow this model for the current user.
Unfollow this model for the current user.
Ignore this model for the current user.
Unignore this model for the current user.
Whether the current user is following this model.
Whether the current user is ignoring this model.
Details
BelongsToMany
followedBy()
Relationship with all users who are following this model.
BelongsToMany
ignoredBy()
Relationship with all users who are ignoring this model.
void
scopeFollowing(Builder $query)
Find only models that the current user is following.
void
scopeIgnoring(Builder $query)
Find only models that the current user is ignoring.
protected void
setNotifications(string|null $value)
Save the current user's notification preference for this model.
void
follow()
Follow this model for the current user.
void
unfollow()
Unfollow this model for the current user.
void
ignore()
Ignore this model for the current user.
void
unignore()
Unignore this model for the current user.
bool
isFollowed()
Whether the current user is following this model.
bool
isIgnored()
Whether the current user is ignoring this model.