Files
shahrzadzandi09/app/Models/Tour.php
T
2026-08-15 13:37:07 +03:30

74 lines
1.3 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 int $travel_type_id
* @property string $title
* @property string $slug
* @property string $description
* @property string $duration
* @property Carbon $start_date
* @property Carbon $end_date
* @property float $price
* @property int $capacity
* @property int $status
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @property TravelType $travelType
* @property Collection|Flight[] $flights
*
* @package App\Models
*/
class Tour extends Model
{
protected $table = 'tours';
public static $snakeAttributes = false;
protected $casts = [
'travel_type_id' => 'int',
'start_date' => 'datetime',
'end_date' => 'datetime',
'price' => 'float',
'capacity' => 'int',
'status' => 'int'
];
protected $fillable = [
'travel_type_id',
'title',
'slug',
'description',
'duration',
'start_date',
'end_date',
'price',
'capacity',
'status'
];
public function travelType()
{
return $this->belongsTo(TravelType::class);
}
public function flights()
{
return $this->belongsToMany(Flight::class, 'tour_flights')
->withPivot('id')
->withTimestamps();
}
}