database/seeds/EventEnumsTableSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        DB::table('event_enums')->delete();
        foreach ([['id' => '1', 'name' => 'debug'], ['id' => '2', 'name' => 'info'], ['id' => '3', 'name' => 'notice'],
                     ['id' => '4', 'name' => 'warning'], ['id' => '5', 'name' => 'error'], ['id' => '6', 'name' => 'critical'
            ], ['id' => '7', 'name' => 'alert'], ['id' => '8', 'name' => 'emergency']] as $data) {
            if (array_key_exists('id', $data)) {
                $data['type_id'] = $data['id'];
                unset($data['id']);
            }
            EventEnum::query()->updateOrCreate($data);
        }
    }
public function run ( ) { DB :: table ( 'event_enums' ) -> delete ( ) ; foreach ( [ [ 'id' => '1' , 'name' => 'debug' ] , [ 'id' => '2' , 'name' => 'info' ] , [ 'id' => '3' , 'name' => 'notice' ] , [ 'id' => '4' , 'name' => 'warning' ] , [ 'id' => '5' , 'name' => 'error' ] , [ 'id' => '6' , 'name' => 'critical' ] , [ 'id' => '7' , 'name' => 'alert' ] , [ 'id' => '8' , 'name' => 'emergency' ] ] as $ data ) { if ( array_key_exists ( 'id' , $ data ) ) { $ data [ 'type_id' ] = $ data [ 'id' ] ; unset ( $ data [ 'id' ] ) ; } EventEnum :: query ( ) -> updateOrCreate ( $ data ) ; } }
Run the database seeds.
Run the database seeds .