PHP 클래스 Flarum\Core\Discussion

상속: extends Flarum\Database\AbstractModel, use trait Flarum\Core\Support\EventGeneratorTrait, use trait Flarum\Core\Support\ScopeVisibilityTrait
파일 보기 프로젝트 열기: flarum/core 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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