Seeder
in package
Class Seeder
Table of Contents
- $config : Database
- An instance of the main Database configuration
- $db : BaseConnection
- Database Connection instance
- $DBGroup : 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.
- __construct() : mixed
- Seeder constructor.
- call() : void
- Loads the specified seeder and runs it.
- faker() : Generator|null
- Gets the Faker Generator instance.
- run() : mixed
- 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
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
Methods
__construct()
Seeder constructor.
public
__construct(Database $config[, BaseConnection|null $db = null ]) : mixed
Parameters
- $config : Database
- $db : BaseConnection|null = null
Return values
mixed —call()
Loads the specified seeder and runs it.
public
call(string $class) : void
Parameters
- $class : string
Tags
Return values
void —faker()
Gets the Faker Generator instance.
public
static faker() : Generator|null
Return values
Generator|null —run()
Run the database seeds. This is where the magic happens.
public
run() : mixed
Child classes must implement this method and take care of inserting their data here.
Tags
Return values
mixed —setPath()
Sets the location of the directory that seed files can be located in.
public
setPath(string $path) : $this
Parameters
- $path : string
Return values
$this —setSilent()
Sets the silent treatment.
public
setSilent(bool $silent) : $this
Parameters
- $silent : bool