Database
  • Get started
    • Database for PHP
    • Install / configure
    • Quick reference
  • Dbi
    • Instance model
    • Instance configuration
    • Instance methods
    • Query examples
  • Dba
    • Query builder
    • Put Methods
    • Scope Methods
    • Return Methods
  • SQLI
    • Query execution
    • Request Methods
    • Query Methods
Powered by GitBook
On this page
  • Request methods
  • get( int $id | array $conditions )
  • getAll( array $conditions )
  • row( [int $id | array $conditions] )
  • SET methods
  1. Dbi

Instance methods

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

PreviousInstance configurationNextQuery examples

Last updated 2 months ago

  • Request methods

    • getGrouped( string $column | array $conditions )

    • row()

    • list()

    • listId() alias idList()

    • listFlat() alias flatList()

    • groupId() alias groupedList()

    • rowKeys()

    • rowValues()

  • Scope methods

    • set()

    • columns()

    • where()

    • orWhere()

    • with()

  • Persist methods

    • update()

    • insert() alias create()

    • replace()

    • delete()

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

get( int $id | array $conditions )
getAll( array
$conditions
)