Instance methods

Each DBI() instance comes with a set of predefined methods.

Request methods

The GET methods are equivalent to the row() and list() methods, but differ by combining a where() method as parameters.

get( int $id | array $conditions )

Returns the first matching row from the data model matching the entered integer or specified conditions. If softDelete is enabled, then only rows where deleted_at is null will be returned.

Return the user where the row id is 1.

$user = User::get(1);

Return the user with the email address hans@gruber.com.

$user = User::get(['email' => 'hans@gruber.com']);

getAll( array $conditions )

Returns all rows matching the specified conditions, as above softDeleted rows are omitted.

$users = User::getAll(['category_id' => 1]);

row( [int $id | array $conditions] )

$user = User::row();

Will return the first row in the table.

$user = User::row(3);

Will return the row matching id = 3.

$user = User::row(['category_id' => 1, 'email' => 'hans@nicksport.com']);

Will return the row matching email = hans@nicksport.com if it has category_id = 1.

SET methods

Last updated