-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update models, changelog, readme and insall command
- Loading branch information
1 parent
11feb21
commit 031c330
Showing
9 changed files
with
272 additions
and
14 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,13 @@ | ||
## v1.1 - 2020-11-22 | ||
|
||
### Fixed | ||
|
||
- Add Models | ||
- Add install command | ||
- Update and fix project | ||
|
||
## v1.0 - 2020-11-22 | ||
|
||
### Added | ||
|
||
- Everything, initial release |
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
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
File renamed without changes.
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,31 @@ | ||
<?php | ||
|
||
namespace HoangPhi\VietnamMap\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\Artisan; | ||
|
||
class InstallCommand extends Command | ||
{ | ||
protected $signature = 'vietnam-map:install'; | ||
|
||
protected $description = 'Vietnam maps install auto import into database'; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
public function handle() | ||
{ | ||
$this->info('Please wait for installing...'); | ||
|
||
Artisan::call('vendor:publish', ['--provider' => 'HoangPhi\VietnamMap\VietnamMapServiceProvider']); | ||
Artisan::call('migrate'); | ||
Artisan::call('config:cache'); | ||
Artisan::call('config:clear'); | ||
Artisan::call('vietnam-map:download'); | ||
|
||
$this->info('Completed to install Vietnam\'s area database !'); | ||
} | ||
} |
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,26 @@ | ||
<?php | ||
|
||
namespace HoangPhi\VietnamMap\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class District extends Model | ||
{ | ||
protected $guarded = []; | ||
|
||
public function __construct(array $attributes = []) | ||
{ | ||
parent::__construct($attributes); | ||
$this->setTable(config('vietnam-maps.tables.districts')); | ||
} | ||
|
||
public function province() | ||
{ | ||
return $this->belongsTo(Province::class, config('vietnam-maps.columns.province_id'), 'id'); | ||
} | ||
|
||
public function wards() | ||
{ | ||
return $this->hasMany(Ward::class); | ||
} | ||
} |
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,21 @@ | ||
<?php | ||
|
||
namespace HoangPhi\VietnamMap\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Province extends Model | ||
{ | ||
protected $guarded = []; | ||
|
||
public function __construct(array $attributes = []) | ||
{ | ||
parent::__construct($attributes); | ||
$this->setTable(config('vietnam-maps.tables.provinces')); | ||
} | ||
|
||
public function districts() | ||
{ | ||
return $this->hasMany(District::class); | ||
} | ||
} |
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,21 @@ | ||
<?php | ||
|
||
namespace HoangPhi\VietnamMap\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Ward extends Model | ||
{ | ||
protected $guarded = []; | ||
|
||
public function __construct(array $attributes = []) | ||
{ | ||
parent::__construct($attributes); | ||
$this->setTable(config('vietnam-maps.tables.wards')); | ||
} | ||
|
||
public function district() | ||
{ | ||
return $this->belongsTo(District::class, config('vietnam-maps.columns.district_id'), 'id'); | ||
} | ||
} |
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