PHP Класс Flarum\Core\Post

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

Открытые свойства

Свойство Тип Описание
$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.

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

Свойство Тип Описание
$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