ichtrojan/laravel-location

Big Seeder File

erayaydin opened this issue · 3 comments

Hello,

Its a feature issue; maybe loading country/city/state data from a json file is better way for seeding. Because currently, editing single file is little bit hard. Maybe we can create 1 nested json data.json or 3 json file countries.json,cities.json and states.json files.

Its easy for development this package with more contributor.

PS: This json files can also generated by package developers and contributors.

I'd be happy to see a pull request from you 😀

Scratch that, reading data that large from JSON files will be a bit slower that just reading from a DB.

It's not "reading from a DB", its read from JSON file and seed to DB @ichtrojan . For example;

// CitiesTableSeeder
// Todo: Use File facade for interact with file
DB::table($citiesTable)->insert(json_decode(file_get_contents('cities.json'))));