ichtrojan / laravel-location

A simple Laravel Package to sort Countries, States and Cities
MIT License
205 stars 44 forks source link

Big Seeder File #16

Closed erayaydin closed 4 years ago

erayaydin commented 5 years ago

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.

ichtrojan commented 5 years ago

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

ichtrojan commented 4 years ago

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

erayaydin commented 4 years ago

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'))));