Seeder
in package
Class Seeder
Table of Contents
Properties
- $config : Database
- An instance of the main Database configuration
- $db : BaseConnection
- Database Connection instance
- $DBGroup : non-empty-string
- The name of the database group to use.
- $forge : Forge
- Database Forge instance.
- $seedPath : string
- Where we can find the Seed files.
- $silent : bool
- If true, will not display CLI messages.
- $faker : Generator|null
- Faker Generator instance.
Methods
- __construct() : mixed
- Seeder constructor.
- call() : mixed
- Loads the specified seeder and runs it.
- faker() : Generator|null
- Gets the Faker Generator instance.
- run() : void
- Run the database seeds. This is where the magic happens.
- setPath() : $this
- Sets the location of the directory that seed files can be located in.
- setSilent() : $this
- Sets the silent treatment.
Properties
$config
An instance of the main Database configuration
protected
Database
$config
$db
Database Connection instance
protected
BaseConnection
$db
$DBGroup
The name of the database group to use.
protected
non-empty-string
$DBGroup
$forge
Database Forge instance.
protected
Forge
$forge
$seedPath
Where we can find the Seed files.
protected
string
$seedPath
$silent
If true, will not display CLI messages.
protected
bool
$silent
= false
$faker
Faker Generator instance.
private
static Generator|null
$faker
= null
Methods
__construct()
Seeder constructor.
public
__construct(Database $config[, BaseConnection|null $db = null ]) : mixed
Parameters
- $config : Database
- $db : BaseConnection|null = null
call()
Loads the specified seeder and runs it.
public
call(string $class) : mixed
Parameters
- $class : string
Tags
faker()
Gets the Faker Generator instance.
public
static faker() : Generator|null
Return values
Generator|nullrun()
Run the database seeds. This is where the magic happens.
public
run() : void
Child classes must implement this method and take care of inserting their data here.
Tags
setPath()
Sets the location of the directory that seed files can be located in.
public
setPath(string $path) : $this
Parameters
- $path : string
Return values
$thissetSilent()
Sets the silent treatment.
public
setSilent(bool $silent) : $this
Parameters
- $silent : bool