Modules/Core/Database/Seeds/CoreDatabaseSeeder.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");
        Model::unguard();
        State::truncate();
        Country::truncate();
        $countries = [
            'Nigeria',
            'Ghana',
            'South Africa',
            'United Kingdom',
            'United States',
            'Singapore',
        ];
        foreach ($countries as $country){
            app(CountriesRepository::class)->saveCountry($country);
        }
        $states = [
            'Abia',
            'Adamawa',
            'Akwa-Ibom',
            'Anambra',
            'Bauchi',
            'Bayelsa',
            'Benue',
            'Borno',
            'Cross-River',
            'Delta',
            'Edo',
            'Enugu',
            'Ebonyi',
            'Ekiti',
            'Federal Capital Territory',
            'Gombe',
            'Imo',
            'Jigawa',
            'Kano',
            'Kaduna',
            'Katsina',
            'Kebbi',
            'Kogi',
            'Kwara',
            'Lagos',
            'Nassarawa',
            'Niger',
            'Ondo',
            'Osun',
            'Ogun',
            'Oyo',
            'Plateau',
            'Rivers',
            'Sokoto',
            'Taraba',
            'Yobe',
            'Zamfara'
        ];
        $nigeria = app(CountriesRepository::class)->getCountryByName();
        foreach ($states as $state){
            app(CountriesRepository::class)->saveState($nigeria->id, $state);
        }
        Model::reguard();
        \DB::statement("SET foreign_key_checks=1");
    }
public function run ( ) { \ DB :: statement ( " SET foreign_key_checks=0 " ) ; Model :: unguard ( ) ; State :: truncate ( ) ; Country :: truncate ( ) ; $ countries = [ 'Nigeria' , 'Ghana' , 'South Africa' , 'United Kingdom' , 'United States' , 'Singapore' , ] ; foreach ( $ countries as $ country ) { app ( CountriesRepository :: class ) -> saveCountry ( $ country ) ; } $ states = [ 'Abia' , 'Adamawa' , 'Akwa-Ibom' , 'Anambra' , 'Bauchi' , 'Bayelsa' , 'Benue' , 'Borno' , 'Cross-River' , 'Delta' , 'Edo' , 'Enugu' , 'Ebonyi' , 'Ekiti' , 'Federal Capital Territory' , 'Gombe' , 'Imo' , 'Jigawa' , 'Kano' , 'Kaduna' , 'Katsina' , 'Kebbi' , 'Kogi' , 'Kwara' , 'Lagos' , 'Nassarawa' , 'Niger' , 'Ondo' , 'Osun' , 'Ogun' , 'Oyo' , 'Plateau' , 'Rivers' , 'Sokoto' , 'Taraba' , 'Yobe' , 'Zamfara' ] ; $ nigeria = app ( CountriesRepository :: class ) -> getCountryByName ( ) ; foreach ( $ states as $ state ) { app ( CountriesRepository :: class ) -> saveState ( $ nigeria -> id , $ state ) ; } Model :: reguard ( ) ; \ DB :: statement ( " SET foreign_key_checks=1 " ) ; }
Run the database seeds.
Run the database seeds .
/// todo:: nigeria states