69 lines
1.2 KiB
PHP
69 lines
1.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class Tour
|
|
*
|
|
* @property int $id
|
|
* @property string $title
|
|
* @property string $summary
|
|
* @property string $description
|
|
* @property int $origin_city_id
|
|
* @property int $destination_city_id
|
|
* @property int $file_id
|
|
* @property string $tour_type
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
*
|
|
* @property Flight $flight
|
|
* @property City $city
|
|
* @property Collection|TourDeparture[] $tourDepartures
|
|
*
|
|
* @package App\Models
|
|
*/
|
|
class Tour extends Model
|
|
{
|
|
protected $table = 'tours';
|
|
public static $snakeAttributes = false;
|
|
|
|
protected $casts = [
|
|
'origin_city_id' => 'int',
|
|
'destination_city_id' => 'int',
|
|
'file_id' => 'int'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'title',
|
|
'summary',
|
|
'description',
|
|
'origin_city_id',
|
|
'destination_city_id',
|
|
'file_id',
|
|
'tour_type'
|
|
];
|
|
|
|
public function flight()
|
|
{
|
|
return $this->belongsTo(Flight::class, 'file_id');
|
|
}
|
|
|
|
public function city()
|
|
{
|
|
return $this->belongsTo(City::class, 'destination_city_id');
|
|
}
|
|
|
|
public function tourDepartures()
|
|
{
|
|
return $this->hasMany(TourDeparture::class);
|
|
}
|
|
}
|