61 lines
1.1 KiB
PHP
61 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Geo\City\Classes;
|
|
|
|
use ORM\Entity as Entity;
|
|
use App\geo\State\Classes\State as State;
|
|
use App\Geo\Country\Classes\Country as country;
|
|
use App\Geo\Postal\Classes\Postal;
|
|
|
|
class City extends Entity {
|
|
|
|
const _tableName = "geo_cities";
|
|
|
|
protected $_timestamps = true;
|
|
protected $_softdelete = true;
|
|
|
|
const _properties = Array(
|
|
'code',
|
|
'name',
|
|
'description',
|
|
'state_id',
|
|
'country_id',
|
|
);
|
|
|
|
protected $_ignore = Array(
|
|
'state',
|
|
'postals',
|
|
'country'
|
|
);
|
|
|
|
const _listable = Array(
|
|
'id',
|
|
'name',
|
|
'code',
|
|
'state_id'
|
|
);
|
|
|
|
const _searchable = Array(
|
|
'name',
|
|
'code'
|
|
);
|
|
|
|
const _orderable = Array(
|
|
'id',
|
|
'code',
|
|
'name'
|
|
);
|
|
|
|
function state(){
|
|
return $this->belongsTo(State::class, 'state_id');
|
|
}
|
|
|
|
function country(){
|
|
return $this->belongsTo(Country::class, 'country_id');
|
|
}
|
|
|
|
function postal(){
|
|
return $this->hasMany(Postal::class, 'city_id');
|
|
}
|
|
|
|
} |