/** * Run the database seeds. * * @return void */ public function run() { foreach ($this->dumpFiles() as $dumpPart) { $query = "LOAD DATA LOCAL INFILE '" . str_replace('\\', '/', $dumpPart) . "'\n INTO TABLE `" . Config::citiesTableName() . "` \n FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'\n LINES TERMINATED BY '\n' IGNORE 1 LINES\n (country,\n city_ascii,\n city,\n region,\n population,\n latitude,\n longitude\n )"; DB::connection()->getpdo()->exec($query); } }
/** * Create a new City instance. * * @param array $attributes */ public function __construct(array $attributes = []) { parent::__construct($attributes); $this->table = Config::citiesTableName(); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::drop(Config::citiesTableName()); }