PHP Класс Flarum\Core\Discussion

Наследование: extends Flarum\Database\AbstractModel, use trait Flarum\Core\Support\EventGeneratorTrait, use trait Flarum\Core\Support\ScopeVisibilityTrait
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$dates
$modifiedPosts array An array of posts that have been modified during this request.
$stateUser User The user for which the state relationship should be loaded.
$table

Открытые методы

Метод Описание
boot ( ) : void Boot the model.
comments ( ) : Illuminate\Database\Eloquent\Relations\HasMany Define the relationship with the discussion's publicly-visible comments.
getModifiedPosts ( ) : array Get the posts that have been modified during this request.
hide ( User $actor = null ) Hide the discussion.
lastPost ( ) : BelongsTo Define the relationship with the discussion's last post.
lastUser ( ) : BelongsTo Define the relationship with the discussion's most recent author.
mergePost ( Flarum\Core\Post\MergeableInterface $post ) : Post Save a post, attempting to merge it with the discussion's last post.
participants ( ) : Builder Query the discussion's participants (a list of unique users who have posted in the discussion).
posts ( ) : Illuminate\Database\Eloquent\Relations\HasMany Define the relationship with the discussion's posts.
postsVisibleTo ( User $user ) : Illuminate\Database\Eloquent\Relations\HasMany Define the relationship with the discussion's posts, but only ones which are visible to the given user.
readers ( ) : BelongsTo Define the relationship with the discussion's readers.
refreshCommentsCount ( ) Refresh the discussion's comments count.
refreshLastPost ( ) Refresh a discussion's last post details.
refreshParticipantsCount ( ) Refresh the discussion's participants count.
rename ( string $title ) Rename the discussion. Raises the DiscussionWasRenamed event.
restore ( ) Restore the discussion.
setLastPost ( Post $post ) Set the discussion's last post details.
setStartPost ( Post $post ) Set the discussion's start post details.
setStateUser ( User $user ) Set the user for which the state relationship should be loaded.
start ( string $title, User $user ) : static Start a new discussion. Raises the DiscussionWasStarted event.
startPost ( ) : BelongsTo Define the relationship with the discussion's first post.
startUser ( ) : BelongsTo Define the relationship with the discussion's author.
state ( User $user = null ) : Illuminate\Database\Eloquent\Relations\HasOne Define the relationship with the discussion's state for a particular user.
stateFor ( User $user ) : DiscussionState Get the state model for a user, or instantiate a new one if it does not exist.

Защищенные методы

Метод Описание
setTitleAttribute ( string $title ) Set the discussion title.

Описание методов

boot() публичный статический Метод

Boot the model.
public static boot ( ) : void
Результат void

comments() публичный Метод

Define the relationship with the discussion's publicly-visible comments.
public comments ( ) : Illuminate\Database\Eloquent\Relations\HasMany
Результат Illuminate\Database\Eloquent\Relations\HasMany

getModifiedPosts() публичный Метод

Get the posts that have been modified during this request.
public getModifiedPosts ( ) : array
Результат array

hide() публичный Метод

Hide the discussion.
public hide ( User $actor = null )
$actor User

lastPost() публичный Метод

Define the relationship with the discussion's last post.
public lastPost ( ) : BelongsTo
Результат Illuminate\Database\Eloquent\Relations\BelongsTo

lastUser() публичный Метод

Define the relationship with the discussion's most recent author.
public lastUser ( ) : BelongsTo
Результат Illuminate\Database\Eloquent\Relations\BelongsTo

mergePost() публичный Метод

The merge logic is delegated to the new post. (As an example, a DiscussionRenamedPost will merge if adjacent to another DiscussionRenamedPost, and delete if the title has been reverted completely.)
public mergePost ( Flarum\Core\Post\MergeableInterface $post ) : Post
$post Flarum\Core\Post\MergeableInterface The post to save.
Результат Post The resulting post. It may or may not be the same post as was originally intended to be saved. It also may not exist, if the merge logic resulted in deletion.

participants() публичный Метод

Query the discussion's participants (a list of unique users who have posted in the discussion).
public participants ( ) : Builder
Результат Illuminate\Database\Eloquent\Builder

posts() публичный Метод

Define the relationship with the discussion's posts.
public posts ( ) : Illuminate\Database\Eloquent\Relations\HasMany
Результат Illuminate\Database\Eloquent\Relations\HasMany

postsVisibleTo() публичный Метод

Define the relationship with the discussion's posts, but only ones which are visible to the given user.
public postsVisibleTo ( User $user ) : Illuminate\Database\Eloquent\Relations\HasMany
$user User
Результат Illuminate\Database\Eloquent\Relations\HasMany

readers() публичный Метод

Define the relationship with the discussion's readers.
public readers ( ) : BelongsTo
Результат Illuminate\Database\Eloquent\Relations\BelongsTo

refreshCommentsCount() публичный Метод

Refresh the discussion's comments count.

refreshLastPost() публичный Метод

Refresh a discussion's last post details.
public refreshLastPost ( )

refreshParticipantsCount() публичный Метод

Refresh the discussion's participants count.

rename() публичный Метод

Rename the discussion. Raises the DiscussionWasRenamed event.
public rename ( string $title )
$title string

restore() публичный Метод

Restore the discussion.
public restore ( )

setLastPost() публичный Метод

Set the discussion's last post details.
public setLastPost ( Post $post )
$post Post

setStartPost() публичный Метод

Set the discussion's start post details.
public setStartPost ( Post $post )
$post Post

setStateUser() публичный статический Метод

Set the user for which the state relationship should be loaded.
public static setStateUser ( User $user )
$user User

setTitleAttribute() защищенный Метод

This automatically creates a matching slug for the discussion.
protected setTitleAttribute ( string $title )
$title string

start() публичный статический Метод

Start a new discussion. Raises the DiscussionWasStarted event.
public static start ( string $title, User $user ) : static
$title string
$user User
Результат static

startPost() публичный Метод

Define the relationship with the discussion's first post.
public startPost ( ) : BelongsTo
Результат Illuminate\Database\Eloquent\Relations\BelongsTo

startUser() публичный Метод

Define the relationship with the discussion's author.
public startUser ( ) : BelongsTo
Результат Illuminate\Database\Eloquent\Relations\BelongsTo

state() публичный Метод

If no user is passed (i.e. in the case of eager loading the 'state' relation), then the static $stateUser property is used.
См. также: Discussion::setStateUser()
public state ( User $user = null ) : Illuminate\Database\Eloquent\Relations\HasOne
$user User
Результат Illuminate\Database\Eloquent\Relations\HasOne

stateFor() публичный Метод

Get the state model for a user, or instantiate a new one if it does not exist.
public stateFor ( User $user ) : DiscussionState
$user User
Результат DiscussionState

Описание свойств

$dates защищенное свойство

protected $dates

$modifiedPosts защищенное свойство

An array of posts that have been modified during this request.
protected array $modifiedPosts
Результат array

$stateUser защищенное статическое свойство

The user for which the state relationship should be loaded.
protected static User,Flarum\Core $stateUser
Результат User

$table защищенное свойство

protected $table