| 12345678910111213141516171819202122232425262728293031 |
- <?php
- namespace App;
- use App\Traits\ModelLogChanging;
- use Illuminate\Database\Eloquent\Model;
- use App\Traits\ModelTimeFormat;
- class City extends Model
- {
- use ModelLogChanging;
- use ModelTimeFormat;
- use ModelLogChanging;
- protected $fillable=[
- 'province_id','name','type'
- ];
- protected $appends=[
- 'province_name'
- ];
- public function province(){
- return $this->belongsTo('App\Province','province_id','id');
- }
- public function getProvinceNameAttribute(){
- return $this['province']? $this['province']['name']:null;
- }
- }
|