class Model

Properties

protected QueryBuilder $queryBuilder The queryBuilder instance.
protected array $attributes A key-value array of attributes of the attributes.

Methods

__construct($attributes, $queryBuilder)

No description

delete()

Delete the attributes from the database.

update($attributes = null)

Update the attributes in the database.

save()

Save the attributes to the database.

string
getPrimaryKey()

Return the primary key name.

string
getPrimaryKeyValue()

Return the primary key value.

newQueryBuilder()

Create a new queryBuilder instance.

getParentModel()

Return the parent model to be able ti use accessor and mutator methods.

__get($name)

Return the value of the given attribute.

__set($name, $value)

Set the value of the given attribute.

string
__toString()

Return the JSON representation of the attributes.

string
dump()

Return a JSON pretty version of the attributes.

Details

at line 29
__construct($attributes, $queryBuilder)

Parameters

$attributes
$queryBuilder

at line 46
delete()

Delete the attributes from the database.

at line 55
update($attributes = null)

Update the attributes in the database.

Parameters

$attributes

at line 67
save()

Save the attributes to the database.

It's an alias of update().

at line 84
protected string getPrimaryKey()

Return the primary key name.

Return Value

string

at line 93
protected string getPrimaryKeyValue()

Return the primary key value.

Return Value

string

at line 103
protected QueryBuilder newQueryBuilder()

Create a new queryBuilder instance.

Return Value

QueryBuilder

at line 114
protected Model getParentModel()

Return the parent model to be able ti use accessor and mutator methods.

Here also we're goinf to inject the attributes to the model.

Return Value

Model

at line 134
__get($name)

Return the value of the given attribute.

Parameters

$name

at line 158
__set($name, $value)

Set the value of the given attribute.

Parameters

$name
$value

at line 181
string __toString()

Return the JSON representation of the attributes.

Return Value

string

at line 191
string dump()

Return a JSON pretty version of the attributes.

Return Value

string