95 lines
1.9 KiB
PHP
95 lines
1.9 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 Tour
|
|
*
|
|
* @property int $id
|
|
* @property string $title
|
|
* @property int|null $file_id
|
|
* @property string $tour_type
|
|
* @property string $summary
|
|
* @property string $description
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
* @property int $origin_airports_id
|
|
* @property int $destination_airports_id
|
|
*
|
|
* @property Airport $originAirport
|
|
* @property Airport $destinationAirport
|
|
* @property File|null $file
|
|
* @property Collection|TourDetail[] $tour_details
|
|
*
|
|
* @package App\Models
|
|
*/
|
|
class Tour extends Model
|
|
{
|
|
use SoftDeletes;
|
|
/**
|
|
* @var float|mixed|null
|
|
*/
|
|
public mixed $nights;
|
|
protected $table = 'tours';
|
|
|
|
protected $casts = [
|
|
'file_id' => 'int',
|
|
'origin_airports_id' => 'int',
|
|
'destination_airports_id' => 'int'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'title',
|
|
'file_id',
|
|
'tour_type',
|
|
'summary',
|
|
'description',
|
|
'origin_airports_id',
|
|
'destination_airports_id',
|
|
'start_date',
|
|
'end_date',
|
|
'price',
|
|
'capacity',
|
|
'status',
|
|
'tour_id'
|
|
];
|
|
|
|
public function originAirport()
|
|
{
|
|
return $this->belongsTo(Airport::class, 'origin_airports_id');
|
|
}
|
|
|
|
public function destinationAirport()
|
|
{
|
|
return $this->belongsTo(Airport::class, 'destination_airports_id');
|
|
}
|
|
|
|
public function file()
|
|
{
|
|
return $this->belongsTo(File::class);
|
|
}
|
|
|
|
public function tour_details()
|
|
{
|
|
return $this->hasMany(TourDetail::class);
|
|
}
|
|
public function favorites()
|
|
{
|
|
return $this->morphMany(Favorite::class, 'favoritable');
|
|
}
|
|
|
|
|
|
public function comments()
|
|
{
|
|
return $this->morphMany(Comment::class, 'commentable');
|
|
}
|
|
}
|