database/seeds/MixesTableSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        $mixes =[
            ['id' => 'mixed', 'name' => 'Mixed','name_kana' => 'ミクスト',],
            ['id' => 'agave100', 'name' => '100% de Agave','name_kana' => 'アガベ100%',],
            ['id' => 'liquor', 'name' => 'Liquor','name_kana' => 'リキュール',],
        ];
        foreach ($mixes as $mix) {
            DB::table('mixes')->insert([
                'id' => $mix['id'],
                'name' => $mix['name'],
                'name_kana' => $mix['name_kana'],
            ]);
        }
    }
public function run ( ) { $ mixes = [ [ 'id' => 'mixed' , 'name' => 'Mixed' , 'name_kana' => 'ミクスト',], [ 'id' => 'agave100' , 'name' => '100% de Agave' , 'name_kana' => 'アガベ100%',], [ 'id' => 'liquor' , 'name' => 'Liquor' , 'name_kana' => 'リキュール',], ] ; foreach ( $ mixes as $ mix ) { DB :: table ( 'mixes' ) -> insert ( [ 'id' => $ mix [ 'id' ] , 'name' => $ mix [ 'name' ] , 'name_kana' => $ mix [ 'name_kana' ] , ] ) ; } }
Run the database seeds.
Run the database seeds .
// 挿入データの設定 // テーブルにデータを挿入