Property | 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. |
Property | Type | Description | |
---|---|---|---|
$dates | |||
$models | array | A map of post types, as specified in the type column, to their classes. | |
$table |
Method | Description | |
---|---|---|
boot ( ) | ||
discussion ( ) : |
Define the relationship with the post's discussion. | |
editUser ( ) : |
Define the relationship with the user who edited the post. | |
getModels ( ) : array | Get the type-to-model map. | |
hideUser ( ) : |
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 ( |
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 ( ) : |
Define the relationship with the post's author. |
public discussion ( ) : |
||
return |
public editUser ( ) : |
||
return |
public hideUser ( ) : |
||
return |
public isVisibleTo ( User $user ) : boolean | ||
$user | User | |
return | boolean |
public scopeAllTypes ( |
||
$query | ||
return |
public user ( ) : |
||
return |
protected static array $models | ||
return | array |
public static string $type | ||
return | string |