database/seeders/ManufacturerSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        if(DB::table('manufacturers')->get()->count() === 0)
        {
            DB::table('manufacturers')->insert(
            [
                [
                    'name' => 'Opel',
                    'founded_on' => date('2005-07-02'),
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s'),
                ],
                [
                    'name' => 'Fiat',
                    'founded_on' => date('2007-07-23'),
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s'),
                ],
                [
                    'name' => 'Alfa romeo',
                    'founded_on' => date('2002-04-21'),
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s'),
                ],
                [
                    'name' => 'Jeep',
                    'founded_on' => date('2001-01-10'),
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s'),
                ],
                [
                    'name' => 'BMW',
                    'founded_on' => date('2007-05-13'),
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s'),
                ],
                [
                    'name' => 'Mercedes',
                    'founded_on' => date('2014-07-17'),
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s'),
                ],
                [
                    'name' => 'Audi',
                    'founded_on' => date('2010-03-15'),
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s'),
                ],
                [
                    'name' => 'VW',
                    'founded_on' => date('2007-08-08'),
                    'created_at' => date('Y-m-d H:i:s'),
                    'updated_at' => date('Y-m-d H:i:s'),
                ],
            ]);
        } else {
            echo "\r\n\e[31m Manufacturers table is not empty. \r\n";
        }
    }
public function run ( ) { if ( DB :: table ( 'manufacturers' ) -> get ( ) -> count ( ) === 0 ) { DB :: table ( 'manufacturers' ) -> insert ( [ [ 'name' => 'Opel' , 'founded_on' => date ( '2005-07-02' ) , 'created_at' => date ( 'Y-m-d H:i:s' ) , 'updated_at' => date ( 'Y-m-d H:i:s' ) , ] , [ 'name' => 'Fiat' , 'founded_on' => date ( '2007-07-23' ) , 'created_at' => date ( 'Y-m-d H:i:s' ) , 'updated_at' => date ( 'Y-m-d H:i:s' ) , ] , [ 'name' => 'Alfa romeo' , 'founded_on' => date ( '2002-04-21' ) , 'created_at' => date ( 'Y-m-d H:i:s' ) , 'updated_at' => date ( 'Y-m-d H:i:s' ) , ] , [ 'name' => 'Jeep' , 'founded_on' => date ( '2001-01-10' ) , 'created_at' => date ( 'Y-m-d H:i:s' ) , 'updated_at' => date ( 'Y-m-d H:i:s' ) , ] , [ 'name' => 'BMW' , 'founded_on' => date ( '2007-05-13' ) , 'created_at' => date ( 'Y-m-d H:i:s' ) , 'updated_at' => date ( 'Y-m-d H:i:s' ) , ] , [ 'name' => 'Mercedes' , 'founded_on' => date ( '2014-07-17' ) , 'created_at' => date ( 'Y-m-d H:i:s' ) , 'updated_at' => date ( 'Y-m-d H:i:s' ) , ] , [ 'name' => 'Audi' , 'founded_on' => date ( '2010-03-15' ) , 'created_at' => date ( 'Y-m-d H:i:s' ) , 'updated_at' => date ( 'Y-m-d H:i:s' ) , ] , [ 'name' => 'VW' , 'founded_on' => date ( '2007-08-08' ) , 'created_at' => date ( 'Y-m-d H:i:s' ) , 'updated_at' => date ( 'Y-m-d H:i:s' ) , ] , ] ) ; } else { echo " \r \n \e [31m Manufacturers table is not empty.  \r \n " ; } }
Run the database seeds.
Run the database seeds .