PHP 클래스 Flarum\Core\Post

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

공개 프로퍼티들

프로퍼티 타입 설명
$type string Should be overwritten by subclasses with the value that is to be stored in the database, which will then be used for mapping the hydrated model instance to the proper subtype.

보호된 프로퍼티들

프로퍼티 타입 설명
$dates
$models array A map of post types, as specified in the type column, to their classes.
$table

공개 메소드들

메소드 설명
boot ( )
discussion ( ) : BelongsTo Define the relationship with the post's discussion.
editUser ( ) : BelongsTo Define the relationship with the user who edited the post.
getModels ( ) : array Get the type-to-model map.
hideUser ( ) : BelongsTo Define the relationship with the user who hid the post.
isVisibleTo ( User $user ) : boolean Determine whether or not this post is visible to the given user.
newFromBuilder ( array $attributes = [], string | null $connection = null ) : static | object Create a new model instance according to the post's type.
scopeAllTypes ( Builder $query ) : Builder Get all posts, regardless of their type, by removing the RegisteredTypesScope global scope constraints applied on this model.
setModel ( string $type, string $model ) : void Set the model for the given post type.
user ( ) : BelongsTo Define the relationship with the post's author.

메소드 상세

boot() 공개 정적인 메소드

public static boot ( )

discussion() 공개 메소드

Define the relationship with the post's discussion.
public discussion ( ) : BelongsTo
리턴 Illuminate\Database\Eloquent\Relations\BelongsTo

editUser() 공개 메소드

Define the relationship with the user who edited the post.
public editUser ( ) : BelongsTo
리턴 Illuminate\Database\Eloquent\Relations\BelongsTo

getModels() 공개 정적인 메소드

Get the type-to-model map.
public static getModels ( ) : array
리턴 array

hideUser() 공개 메소드

Define the relationship with the user who hid the post.
public hideUser ( ) : BelongsTo
리턴 Illuminate\Database\Eloquent\Relations\BelongsTo

isVisibleTo() 공개 메소드

Determine whether or not this post is visible to the given user.
public isVisibleTo ( User $user ) : boolean
$user User
리턴 boolean

newFromBuilder() 공개 메소드

Create a new model instance according to the post's type.
public newFromBuilder ( array $attributes = [], string | null $connection = null ) : static | object
$attributes array
$connection string | null
리턴 static | object

scopeAllTypes() 공개 메소드

Get all posts, regardless of their type, by removing the RegisteredTypesScope global scope constraints applied on this model.
public scopeAllTypes ( Builder $query ) : Builder
$query Illuminate\Database\Eloquent\Builder
리턴 Illuminate\Database\Eloquent\Builder

setModel() 공개 정적인 메소드

Set the model for the given post type.
public static setModel ( string $type, string $model ) : void
$type string The post type.
$model string The class name of the model for that type.
리턴 void

user() 공개 메소드

Define the relationship with the post's author.
public user ( ) : BelongsTo
리턴 Illuminate\Database\Eloquent\Relations\BelongsTo

프로퍼티 상세

$dates 보호되어 있는 프로퍼티

protected $dates

$models 보호되어 있는 정적으로 프로퍼티

A map of post types, as specified in the type column, to their classes.
protected static array $models
리턴 array

$table 보호되어 있는 프로퍼티

protected $table

$type 공개적으로 정적으로 프로퍼티

Should be overwritten by subclasses with the value that is to be stored in the database, which will then be used for mapping the hydrated model instance to the proper subtype.
public static string $type
리턴 string