Files
exchange-2.0/app/Models/District.php
T

52 lines
994 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class District
* @package App\Models
*
* @property int $country_id
* @property int $state_id
* @property string $name
* @property string $postcode
*/
class District extends AbstractModel
{
use SoftDeletes;
protected $table = 'districts';
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'deleted_at' => 'datetime',
];
}
/**
* @return BelongsTo
*/
public function country(): BelongsTo
{
return $this->belongsTo(Country::class, 'country_id', 'id');
}
/**
* @return BelongsTo
**/
public function state(): BelongsTo
{
return $this->BelongsTo(State::class, 'state_id', 'id');
}
}