marshmallow / dataset-google-geotargets
Import all GeoTargets from Google into your Laravel project.
Installs: 2 525
Dependents: 0
Suggesters: 1
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 3
Requires
- php: ^7.4|^8.0
- marshmallow/dataset-country: ^1.2
- marshmallow/sluggable: ^1.0
This package is auto-updated.
Last update: 2024-10-30 01:37:19 UTC
README
Laravel Google Geo Targets
This dataset contains all the geo location from Google. We update the source when Google publishes a new one and you can reseed your data. By default only the Netherlands is imported but you can change this in the config if you want to.
Installatie
composer require marshmallow/dataset-google-geotargets
Migrate
Before you run the migration, please publish the migrations first.
php artisan vendor:publish --provider="Marshmallow\Datasets\GoogleGeoTargets\ServiceProvider" --tag="migrations" ``` Run `php artisan migrate` to create the database schema's. # Publish the config Publish the config so you are able to choose which countries will be seeded to the table and which data types will be seeded. By default this is set to The Nederlands and data types. If you want this to be seeded, you don't need to publish the config. ```bash php artisan vendor:publish --provider="Marshmallow\Datasets\GoogleGeoTargets\ServiceProvider"
return [ /** * Specify the countries you wish to sync. An empty array will * result in the seeder seeding all the data. */ 'countries' => [ 'NL', ], /** * Specify the types you wish to sync. */ 'types' => [ GoogleGeoTarget::CITY, // ... ] ];
Seed the table
We need to seed to tables, the country table and the Google Geo Target tables.
# Seed the country table. php artisan db:seed --class="Marshmallow\Datasets\Country\Seeders\CountrySeeder" # Seed the Google Geo Target table php artisan db:seed --class="Marshmallow\Datasets\GoogleGeoTargets\Seeds\GoogleGeoTargetsSeeder"
Usage
$country = Country::alpha2('NL'); $country->provinces->first()->cities->first()->name;
Copyright (c) 2020 marshmallow