PHP Class Devise\Support\DeviseSeeder

Inheritance: extends Illuminate\Database\Seeder
Datei anzeigen Open project: devisephp/cms

Public Methods

Method Description
findOrCreateRow ( string $tableName, array $uniqueKeys, array $data, $timestamps = true ) : StdObject We are creating a new page when it does not exist already.
run ( ) : void Run the database seeds.

Protected Methods

Method Description
callOnlyOnce ( [type] $seederClass ) : [type] This gives us the ability to call the seeds only once. We will keep up with what classes have ran in the database and that way we know which ones to call and which ones not to call.
findOrCreateRows ( string $tableName, array | string $uniqueKeys, $rows, boolean $timestamps = true ) : array Iterate over all the rows and insert them one by one checking for existing before
findRow ( string $tableName, array $uniqueKeys, array $data ) : StdObject Search for the row with these unique keys

Method Details

callOnlyOnce() protected method

This gives us the ability to call the seeds only once. We will keep up with what classes have ran in the database and that way we know which ones to call and which ones not to call.
protected callOnlyOnce ( [type] $seederClass ) : [type]
$seederClass [type]
return [type]

findOrCreateRow() public method

We use the route name as it should be unique. If an row already exists with the same route name we just ignore the insert. We use similiar logic for new page versions. If a page does not have a page version then it will not be available at it's url because we don't show pages unless there is an active page version
public findOrCreateRow ( string $tableName, array $uniqueKeys, array $data, $timestamps = true ) : StdObject
$tableName string
$uniqueKeys array
$data array
return StdObject

findOrCreateRows() protected method

Iterate over all the rows and insert them one by one checking for existing before
protected findOrCreateRows ( string $tableName, array | string $uniqueKeys, $rows, boolean $timestamps = true ) : array
$tableName string
$uniqueKeys array | string
$timestamps boolean
return array

findRow() protected method

Search for the row with these unique keys
protected findRow ( string $tableName, array $uniqueKeys, array $data ) : StdObject
$tableName string
$uniqueKeys array
$data array
return StdObject

run() public method

Run the database seeds.
public run ( ) : void
return void