PHP Class Flarum\Database\AbstractModel

Adds the ability for custom relations to be added to a model during runtime. These relations behave in the same way that you would expect; they can be queried, eager loaded, and accessed as an attribute.
Inheritance: extends Illuminate\Database\Eloquent\Model
ファイルを表示 Open project: flarum/core Class Usage Examples

Public Properties

Property Type Description
$timestamps boolean Indicates if the model should be timestamped. Turn off by default.

Protected Properties

Property Type Description
$afterDeleteCallbacks callable[] An array of callbacks to be run once after the model is deleted.
$afterSaveCallbacks callable[] An array of callbacks to be run once after the model is saved.

Public Methods

Method Description
__call ( $method, $arguments )
__construct ( array $attributes = [] )
afterDelete ( callable $callback ) : void Register a callback to be run once after the model is deleted.
afterSave ( callable $callback ) : void Register a callback to be run once after the model is saved.
boot ( )
getAttribute ( string $key ) : mixed Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.
getDates ( ) : array Get the attributes that should be converted to dates.
releaseAfterDeleteCallbacks ( ) : callable[]
releaseAfterSaveCallbacks ( ) : callable[]

Protected Methods

Method Description
getCustomRelation ( string $name ) : mixed Get a custom relation object.

Method Details

__call() public method

public __call ( $method, $arguments )

__construct() public method

public __construct ( array $attributes = [] )
$attributes array

afterDelete() public method

Register a callback to be run once after the model is deleted.
public afterDelete ( callable $callback ) : void
$callback callable
return void

afterSave() public method

Register a callback to be run once after the model is saved.
public afterSave ( callable $callback ) : void
$callback callable
return void

boot() public static method

public static boot ( )

getAttribute() public method

Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.
public getAttribute ( string $key ) : mixed
$key string
return mixed

getCustomRelation() protected method

Get a custom relation object.
protected getCustomRelation ( string $name ) : mixed
$name string
return mixed

getDates() public method

Get the attributes that should be converted to dates.
public getDates ( ) : array
return array

releaseAfterDeleteCallbacks() public method

public releaseAfterDeleteCallbacks ( ) : callable[]
return callable[]

releaseAfterSaveCallbacks() public method

public releaseAfterSaveCallbacks ( ) : callable[]
return callable[]

Property Details

$afterDeleteCallbacks protected_oe property

An array of callbacks to be run once after the model is deleted.
protected callable[] $afterDeleteCallbacks
return callable[]

$afterSaveCallbacks protected_oe property

An array of callbacks to be run once after the model is saved.
protected callable[] $afterSaveCallbacks
return callable[]

$timestamps public_oe property

Indicates if the model should be timestamped. Turn off by default.
public bool $timestamps
return boolean