Documentation

FabricatorModel

FabricatorModel

An interface defining the required methods and properties needed for a model to qualify for use with the Fabricator class. While interfaces cannot enforce properties, the following are required for use with Fabricator:

Table of Contents

find()  : array<string|int, mixed>|object|null
Fetches the row of database from $this->table with a primary key matching $id.
insert()  : int|string|bool
Inserts data into the current table. If an object is provided, it will attempt to convert it to an array.

Methods

find()

Fetches the row of database from $this->table with a primary key matching $id.

public find([mixed|array<string|int, mixed>|null $id = null ]) : array<string|int, mixed>|object|null
Parameters
$id : mixed|array<string|int, mixed>|null = null

One primary key or an array of primary keys

Return values
array<string|int, mixed>|object|null

The resulting row of data, or null.

insert()

Inserts data into the current table. If an object is provided, it will attempt to convert it to an array.

public insert([array<string|int, mixed>|object $data = null ][, bool $returnID = true ]) : int|string|bool
Parameters
$data : array<string|int, mixed>|object = null
$returnID : bool = true

Whether insert ID should be returned or not.

Tags
throws
ReflectionException
Return values
int|string|bool

Search results