Channel
class Channel extends Model (View source)
Traits
Methods to make a model "followable" per user.
Methods to manage a model's icon
attribute.
Methods to manage permissions on a model.
Methods to give a model per-user state.
Methods for models that can be a part of the forum "structure", like channels, pages, links, and headings.
Methods to associate uploaded images with a model.
Properties
static protected | $unguarded | from Model | |
Collection read-only | $followedBy | from Followable | |
Collection read-only | $ignoredBy | from Followable | |
string | $icon | from HasIcon | |
?string | $icon_file | The path to the icon file, if the icon is the
|
from HasIcon |
PermissionCollection read-only | $permissions | from HasPermissions | |
Structure read-only | $structure | from Structurable | |
static protected Formatter[] | $formatters | from UsesFormatter | |
$timestamps | |||
protected | $casts | ||
int | $id | ||
string | $name | ||
string | $slug | ||
?string | $description | ||
?string | $instructions | ||
?array | $filters | ||
?string | $layout | ||
?array | $layout_config | ||
bool | $ignore | ||
bool | $answerable | ||
?array | $translations | ||
?int | $posts_reaction_set_id | ||
?int | $comments_reaction_set_id | ||
Collection read-only | $posts | ||
Collection read-only | $newPosts | ||
Collection read-only | $unreadPosts | ||
ChannelUser read-only | $userState | ||
ReactionSet read-only | $postsReactionSet | ||
ReactionSet read-only | $commentsReactionSet | ||
string read-only | $url | ||
string read-only | $edit_url |
Methods
Relationship with all users who are following this model.
Find only models that the current user is following.
No description
Save the current user's notification preference for this model.
No description
Relationship with the permission records pertaining to this model.
No description
No description
Get the model IDs that the given user has permission for.
Relationship with the node for this model within the forum structure.
Set a formatter instance for this model.
No description
Relationship with the channel's posts.
Relationship with posts that are followed and contain unread content.
Scope to select count of posts that are new since a channel was followed.
Relationship with posts that are new since this channel was followed.
No description
No description
No description
No description
No description
Get the Turbo Streams that should be sent when this post is updated.
Details
in
Model at line 18
getConnectionName()
No description
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)
No description
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()
No description
void
saveIcon(array $icon)
Save the icon using input from an
protected Attribute
iconFile()
No description
static void
bootHasPermissions()
No description
MorphMany
permissions()
Relationship with the permission records pertaining to this model.
array
abilities()
No description
array
defaultAbilities()
No description
void
savePermissions(array|null $grid)
Save the permissions to the database.
bool
isPublic(string $ability = 'view')
No description
static array|null
allPermitted(User|null $user, string $ability = 'view')
Get the model IDs that the given user has permission for.
If the user is an admin, the result will be null, meaning there is no restriction on the models they have permission for.
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.
HasUserState
loadUserState(User $user)
Load the userState relationship for the given user.
static void
bootStructurable()
No description
MorphOne
structure()
Relationship with the node for this model within the forum structure.
HtmlString|string
format(string $attribute, User $user = null)
Render an attribute as HTML for the given user.
static Formatter
getFormatter(string $attribute)
Set a formatter instance for this model.
static void
setFormatter(string $attribute, Formatter $formatter)
Set a formatter instance for this model.
getAttribute($key)
No description
setAttribute($key, $value)
No description
static protected void
booting()
No description
HasMany
posts()
Relationship with the channel's posts.
HasMany
unreadPosts()
Relationship with posts that are followed and contain unread content.
void
scopeWithNewPostsCount(Builder $query)
Scope to select count of posts that are new since a channel was followed.
HasMany
newPosts()
Relationship with posts that are new since this channel was followed.
BelongsTo
postsReactionSet()
No description
BelongsTo
commentsReactionSet()
No description
BelongsToMany
taxonomies()
No description
protected Attribute
url()
No description
protected Attribute
editUrl()
No description
array
streamUpdated()
Get the Turbo Streams that should be sent when this post is updated.