abstract class AbstractModel extends Model

Base model class, building on Eloquent.

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.

Properties

bool $timestamps Indicates if the model should be timestamped. Turn off by default.
protected callable[] $afterSaveCallbacks An array of callbacks to be run once after the model is saved.
protected callable[] $afterDeleteCallbacks An array of callbacks to be run once after the model is deleted.
static $customRelations
static $dateAttributes
static $defaults

Methods

static 
boot()

{@inheritdoc}

__construct(array $attributes = [])

{@inheritdoc}

array
getDates()

Get the attributes that should be converted to dates.

mixed
getAttribute(string $key)

Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.

mixed
getCustomRelation(string $name)

Get a custom relation object.

void
afterSave(callable $callback)

Register a callback to be run once after the model is saved.

void
afterDelete(callable $callback)

Register a callback to be run once after the model is deleted.

callable[]
releaseAfterSaveCallbacks()

No description

callable[]
releaseAfterDeleteCallbacks()

No description

__call($method, $arguments)

{@inheritdoc}

Details

static boot()

{@inheritdoc}

__construct(array $attributes = [])

{@inheritdoc}

Parameters

array $attributes

array getDates()

Get the attributes that should be converted to dates.

Return Value

array

mixed getAttribute(string $key)

Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.

Parameters

string $key

Return Value

mixed

protected mixed getCustomRelation(string $name)

Get a custom relation object.

Parameters

string $name

Return Value

mixed

void afterSave(callable $callback)

Register a callback to be run once after the model is saved.

Parameters

callable $callback

Return Value

void

void afterDelete(callable $callback)

Register a callback to be run once after the model is deleted.

Parameters

callable $callback

Return Value

void

callable[] releaseAfterSaveCallbacks()

Return Value

callable[]

callable[] releaseAfterDeleteCallbacks()

Return Value

callable[]

__call($method, $arguments)

{@inheritdoc}

Parameters

$method
$arguments