Seed
in package
Seed query
Table of Contents
Properties
- $tableName : string
- Table name
Methods
- __construct() : mixed
- Constructor
- create() : bool
- Create record if not exist
- createFromArray() : bool
- Create records from array
- delete() : bool
- Delete record
- update() : bool
- Update record
- updateFromArray() : bool
- Update records from array
- updateOrCreate() : bool
- Update or create record
- updateOrCreateFromArray() : bool
- Update records from array
- withModel() : mixed
- Seed with model
- createSearchValues() : array<string|int, mixed>
- Create search item values
Properties
$tableName
Table name
protected
string
$tableName
Methods
__construct()
Constructor
public
__construct(string|null $tableName) : mixed
Parameters
- $tableName : string|null
create()
Create record if not exist
public
create(array<string|int, mixed> $search, array<string|int, mixed> $values) : bool
Parameters
- $search : array<string|int, mixed>
- $values : array<string|int, mixed>
Return values
boolcreateFromArray()
Create records from array
public
createFromArray(array<string|int, mixed> $searchKeys, array<string|int, mixed> $items[, Closure|null $callback = null ]) : bool
Parameters
- $searchKeys : array<string|int, mixed>
- $items : array<string|int, mixed>
- $callback : Closure|null = null
Return values
booldelete()
Delete record
public
delete(array<string|int, mixed> $search) : bool
Parameters
- $search : array<string|int, mixed>
Return values
boolupdate()
Update record
public
update(array<string|int, mixed> $search, array<string|int, mixed> $values) : bool
Parameters
- $search : array<string|int, mixed>
- $values : array<string|int, mixed>
Return values
boolupdateFromArray()
Update records from array
public
updateFromArray(array<string|int, mixed> $searchKeys, array<string|int, mixed> $items[, Closure|null $callback = null ]) : bool
Parameters
- $searchKeys : array<string|int, mixed>
- $items : array<string|int, mixed>
- $callback : Closure|null = null
Return values
boolupdateOrCreate()
Update or create record
public
updateOrCreate(array<string|int, mixed> $search, array<string|int, mixed> $values) : bool
Parameters
- $search : array<string|int, mixed>
- $values : array<string|int, mixed>
Return values
boolupdateOrCreateFromArray()
Update records from array
public
updateOrCreateFromArray(array<string|int, mixed> $searchKeys, array<string|int, mixed> $items[, Closure|null $callback = null ]) : bool
Parameters
- $searchKeys : array<string|int, mixed>
- $items : array<string|int, mixed>
- $callback : Closure|null = null
Return values
boolwithModel()
Seed with model
public
static withModel(string $className, string|null $extensionName[, Closure|null $callback = null ]) : mixed
Parameters
- $className : string
- $extensionName : string|null
- $callback : Closure|null = null
createSearchValues()
Create search item values
protected
createSearchValues(array<string|int, mixed> $keys, array<string|int, mixed> $item) : array<string|int, mixed>
Parameters
- $keys : array<string|int, mixed>
- $item : array<string|int, mixed>