Files
aso/app/Models/Address.php
Server D3 Linksehat 1bf608b1ed Server 103 Commit
2024-07-18 16:05:33 +07:00

66 lines
1.2 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',
];
protected $hidden = [
'created_at',
'updated_at',
'deleted_at',
'created_by',
'updated_by',
'deleted_by',
];
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');
}
}