78 lines
1.4 KiB
PHP
78 lines
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
/**
|
|
* Class City
|
|
*
|
|
* @property int $id
|
|
* @property int $county_id
|
|
* @property int $province_id
|
|
* @property string $name
|
|
* @property int $status
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
* @property string|null $deleted_at
|
|
*
|
|
* @property Country $country
|
|
* @property Province $province
|
|
* @property Collection|Airport[] $airports
|
|
* @property Collection|Tour[] $tours
|
|
* @property Collection|User[] $users
|
|
*
|
|
* @package App\Models
|
|
*/
|
|
class City extends Model
|
|
{
|
|
use SoftDeletes;
|
|
protected $table = 'cities';
|
|
public static $snakeAttributes = false;
|
|
|
|
protected $casts = [
|
|
'county_id' => 'int',
|
|
'province_id' => 'int',
|
|
'status' => 'int'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'county_id',
|
|
'province_id',
|
|
'name',
|
|
'status'
|
|
];
|
|
|
|
public function country()
|
|
{
|
|
return $this->belongsTo(Country::class, 'county_id');
|
|
}
|
|
|
|
public function province()
|
|
{
|
|
return $this->belongsTo(Province::class);
|
|
}
|
|
|
|
public function airports()
|
|
{
|
|
return $this->hasMany(Airport::class);
|
|
}
|
|
|
|
public function tours()
|
|
{
|
|
return $this->hasMany(Tour::class, 'destination_city_id');
|
|
}
|
|
|
|
public function users()
|
|
{
|
|
return $this->hasMany(User::class);
|
|
}
|
|
}
|