-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 52e3410
Showing
4 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "matriphe/laravel-city-province-id", | ||
"description": "Indonesia city and province data migration and seeder for Laravel.", | ||
"keywords": [ | ||
"laravel", "data", "seeder", "city", "province", "indonesia", "id", "ina" | ||
], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Muhammad Zamroni", | ||
"email": "halo@matriphe.com" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.3.0", | ||
"illuminate/support": ">=4.1 <6.0" | ||
}, | ||
"require-dev": { | ||
"illuminate/database": ">=4.1 <6.0", | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Matriphe\\LaravelCityProvinceID\\": "src/" | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Laravel 4 - Persistant Settings | ||
* | ||
* @author Andreas Lutro <anlutro@gmail.com> | ||
* @license http://opensource.org/licenses/MIT | ||
* @package l4-settings | ||
*/ | ||
|
||
namespace Matriphe\LaravelCityProvinceID; | ||
|
||
use Illuminate\Foundation\Application; | ||
|
||
class ServiceProvider extends \Illuminate\Support\ServiceProvider | ||
{ | ||
protected $defer = true; | ||
|
||
public function register() | ||
{ | ||
if (version_compare(Application::VERSION, '5.0', '>=')) { | ||
$this->mergeConfigFrom( | ||
__DIR__.'/config/config.php', 'laravelcityprovinceid' | ||
); | ||
} | ||
} | ||
|
||
public function boot() | ||
{ | ||
if (version_compare(Application::VERSION, '5.0', '>=')) { | ||
$this->publishes([ | ||
__DIR__.'/config/config.php' => config_path('laravelcityprovinceid.php') | ||
], 'config'); | ||
|
||
$this->publishes([ | ||
__DIR__.'/migrations/' => database_path('migrations') | ||
], 'migrations'); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
|
||
return [ | ||
'city' => 'cities', | ||
'province' => 'provinces', | ||
]; |
66 changes: 66 additions & 0 deletions
66
src/migrations/2015_09_28_175100_create_city_province_tables.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateCityProvinceTables extends Migration | ||
{ | ||
public function __construct() | ||
{ | ||
$this->tablename_city = config('laravelcityprovinceid.city'); | ||
$this->tablename_province = config('laravelcityprovinceid.province'); | ||
} | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create($this->tablename_city, function(Blueprint $table) | ||
{ | ||
$table->smallInteger('city_id', 1, 1); | ||
$table->tinyInteger('province_id')->unsigned()->index(); | ||
$table->string('city_name', 50)->index(); | ||
$table->string('city_name_full', 100)->index(); | ||
$table->enum('city_type', ['kabupaten', 'kota'])->nullable(); | ||
$table->float('city_lat', 10, 6)->nullable()->index(); | ||
$table->float('city_lon', 10, 6)->nullable()->index(); | ||
}); | ||
Schema::create($this->tablename_city, function(Blueprint $table) | ||
{ | ||
$table->tinyInteger('province_id', 1, 1); | ||
$table->string('province_name', 50); | ||
$table->string('province_name_abbr', 50); | ||
$table->string('province_name_id', 50); | ||
$table->string('province_name_en', 50); | ||
$table->smallInteger('province_capital_city_id')->unsigned()->index(); | ||
$table->string('iso_code', 5)->index(); | ||
$table->string('iso_name', 50); | ||
$table->enum('iso_type', | ||
[ | ||
'province', | ||
'autonomous province', | ||
'special district', | ||
'special region' | ||
]); | ||
$table->string('iso_geounit', 2)->index(); | ||
$table->tinyInteger('timezone'); | ||
$table->float('province_lat', 10, 6)->nullable()->index(); | ||
$table->float('province_lon', 10, 6)->nullable()->index(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop($this->tablename_city); | ||
Schema::drop($this->tablename_province); | ||
} | ||
} | ||
|