seantrant
7/15/2016 - 4:40 PM

Maker seeder + Seeder layout + Run seeder

Maker seeder + Seeder layout + Run seeder

// First Vagrant ssh to site directory and run

php artisan make:seeder UsersTableSeeder     //where UsersTableSeeder is the name of the seeder you are making

<?php
use Illuminate\Database\Seeder;
class populateUserType extends Seeder
{
    public function run()
    {
        DB::table('provinces')->truncate();     // where provinces is the table name

        // make query and fire
        $query = "INSERT INTO `provinces` (`id`, `name`) VALUES     // where provinces is the table name
        (1, 'Northland'),
        (2, 'Auckland'),";

        DB::statement($query);
    }
}

or
DB::table('plan_list')->insert(array(
     array('id'=>'1','name'=>'7 Day Trial','price'=>'0.00'),
     array('id'=>'2','name'=>'1 Month','price'=>'4.99'),
     array('id'=>'3','name'=>'1 Year Full Access','price'=>'19.99'),
));


//To run seeder
php artisan db:seed --class=UsersTableSeeder       // where UsersTableSeeder is the name of the seed