56 lines
1.0 KiB
PHP
Executable File
56 lines
1.0 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Address extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'addressable_type',
|
|
'addressable_id',
|
|
'use',
|
|
'type',
|
|
'text',
|
|
'line',
|
|
'province_id',
|
|
'city_id',
|
|
'district_id',
|
|
'village_id',
|
|
'postal_code',
|
|
'country',
|
|
'lat',
|
|
'lng',
|
|
'period_start',
|
|
'period_end',
|
|
];
|
|
|
|
public function addressable()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
public function province()
|
|
{
|
|
return $this->belongsTo(Province::class, 'province_id');
|
|
}
|
|
|
|
public function city()
|
|
{
|
|
return $this->belongsTo(City::class, 'city_id');
|
|
}
|
|
|
|
public function district()
|
|
{
|
|
return $this->belongsTo(District::class, 'district_id');
|
|
}
|
|
|
|
public function village()
|
|
{
|
|
return $this->belongsTo(Village::class, 'village_id');
|
|
}
|
|
}
|