12/19/2016 - 4:24 PM

Sample usage of Laravel Seeder

Sample usage of Laravel Seeder


 *	custom seeder classes are called from the default DatabaseSeeder via '$this->call('UserTableSeeder');'
 *	php artisan db:seed runs DatabaseSeeder
 *	php artisan db:seed --class=UserTableSeeder runs custom seeders
 *	php artisan migrate:refresh --seed rolls back all migrations and executes them followed by seeding

class UserTableSeeder extends Seeder {

  public function run()
    // empty table
    // add entries
    User::create(array('email' => 'example@email.com'));