PHP Class Flarum\Core\Post

Inheritance: extends Flarum\Database\AbstractModel, use trait Flarum\Core\Support\EventGeneratorTrait, use trait Flarum\Core\Support\ScopeVisibilityTrait
Afficher le fichier Open project: flarum/core Class Usage Examples

Méthodes publiques

Свойство Type Description
$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 Properties

Свойство Type Description
$dates
$models array A map of post types, as specified in the type column, to their classes.
$table

Méthodes publiques

Méthode Description
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.

Method Details

boot() public static méthode

public static boot ( )

discussion() public méthode

Define the relationship with the post's discussion.
public discussion ( ) : BelongsTo
Résultat Illuminate\Database\Eloquent\Relations\BelongsTo

editUser() public méthode

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

getModels() public static méthode

Get the type-to-model map.
public static getModels ( ) : array
Résultat array

hideUser() public méthode

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

isVisibleTo() public méthode

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

newFromBuilder() public méthode

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
Résultat static | object

scopeAllTypes() public méthode

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
Résultat Illuminate\Database\Eloquent\Builder

setModel() public static méthode

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.
Résultat void

user() public méthode

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

Property Details

$dates protected_oe property

protected $dates

$models protected_oe static_oe property

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

$table protected_oe property

protected $table

$type public_oe static_oe property

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
Résultat string