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 <p>Indicates if the model should be timestamped. Turn off by default.</p>
protected callable[] $afterSaveCallbacks <p>An array of callbacks to be run once after the model is saved.</p>
protected callable[] $afterDeleteCallbacks <p>An array of callbacks to be run once after the model is deleted.</p>
static $customRelations
static $customCasts
static $defaults
protected string|null $tableAlias <p>An alias for the table name, used in queries.</p>
int|null $id

Methods

static 
boot()

<p>{@inheritdoc}</p>

__construct(array $attributes = [])

<p>{@inheritdoc}</p>

getCasts()

<p>{@inheritdoc}</p>

mixed
getAttribute(string $key)

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

mixed
getCustomRelation(string $name)

<p>Get a custom relation object.</p>

void
afterSave(callable $callback)

<p>Register a callback to be run once after the model is saved.</p>

void
afterDelete(callable $callback)

<p>Register a callback to be run once after the model is deleted.</p>

callable[]
releaseAfterSaveCallbacks()

No description

callable[]
releaseAfterDeleteCallbacks()

No description

__call($method, $arguments)

<p>{@inheritdoc}</p>

newModelQuery()

No description

qualifyColumn($column)

No description

withTableAlias(callable $callback)

No description

newCollection(Collection|array $models = [])

No description

Details

static boot()

<p>{@inheritdoc}</p>

__construct(array $attributes = [])

<p>{@inheritdoc}</p>

Parameters

array $attributes

getCasts()

<p>{@inheritdoc}</p>

mixed getAttribute(string $key)

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

Parameters

string $key

Return Value

mixed

protected mixed getCustomRelation(string $name)

<p>Get a custom relation object.</p>

Parameters

string $name

Return Value

mixed

void afterSave(callable $callback)

<p>Register a callback to be run once after the model is saved.</p>

Parameters

callable $callback

Return Value

void

void afterDelete(callable $callback)

<p>Register a callback to be run once after the model is deleted.</p>

Parameters

callable $callback

Return Value

void

callable[] releaseAfterSaveCallbacks()

Return Value

callable[]

callable[] releaseAfterDeleteCallbacks()

Return Value

callable[]

__call($method, $arguments)

<p>{@inheritdoc}</p>

Parameters

$method
$arguments

newModelQuery()

qualifyColumn($column)

Parameters

$column

withTableAlias(callable $callback)

Parameters

callable $callback

newCollection(Collection|array $models = [])

Parameters

Collection|array $models