database/seeders/TagSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        DB::statement('SET FOREIGN_KEY_CHECKS=0');
        Tag::truncate();
        DB::statement('SET FOREIGN_KEY_CHECKS=1');
        $tags = [
            ['tag'=>'soleil'],
            ['tag'=>'écologie'],
            ['tag'=>'mer'],
        ];
        DB::table('tags')->insert($tags);
    }
public function run ( ) { DB :: statement ( 'SET FOREIGN_KEY_CHECKS=0' ) ; Tag :: truncate ( ) ; DB :: statement ( 'SET FOREIGN_KEY_CHECKS=1' ) ; $ tags = [ [ 'tag' => 'soleil' ] , [ 'tag' => 'écologie'] , [ 'tag' => 'mer' ] , ] ; DB :: table ( 'tags' ) -> insert ( $ tags ) ; }
Run the database seeds.
Run the database seeds .
//Empty the table first //Define data //Insert data in the table