class Model extends DB

The Database Model provides a base class for all database models.

Properties

protected QueryBuilder $queryBuilder The query builder instance. from DB
protected string $table The table associated with the model.
protected string $primaryKey The primary key for the model.

Methods

__construct()

No description

static DB
table($table, $primaryKey = 'id')

Instantiate a new DB model with the given table name.

from DB
setPrimaryKey($primaryKey)

Set the primary key for the model.

from DB
__call(string $name, array $arguments)

Proxy method for the query builder.

from DB
static mixed
__callStatic(string $name, array $arguments)

We will this magic method to handle all statuc/instance methods.

static
all()

No description

Details

at line 33
__construct()

in DB at line 41
static DB table($table, $primaryKey = 'id')

Instantiate a new DB model with the given table name.

Parameters

$table
$primaryKey

Return Value

DB

in DB at line 57
setPrimaryKey($primaryKey)

Set the primary key for the model.

Parameters

$primaryKey

in DB at line 76
__call(string $name, array $arguments)

Proxy method for the query builder.

Parameters

string $name The method name.
array $arguments The method arguments.

at line 59
static mixed __callStatic(string $name, array $arguments)

We will this magic method to handle all statuc/instance methods.

Parameters

string $name
array $arguments

Return Value

mixed

at line 17
static all()

Return Value

static