79 lines
1.5 KiB
PHP
79 lines
1.5 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|null $travel_type_id
|
|
* @property string $title
|
|
* @property string|null $slug
|
|
* @property string|null $image
|
|
* @property string|null $description
|
|
* @property string|null $duration
|
|
* @property Carbon|null $start_date
|
|
* @property Carbon|null $end_date
|
|
* @property float $price
|
|
* @property int|null $capacity
|
|
* @property int $views_count
|
|
* @property int $status
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
*
|
|
* @property TravelType|null $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',
|
|
'views_count' => 'int',
|
|
'status' => 'int'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'travel_type_id',
|
|
'title',
|
|
'slug',
|
|
'image',
|
|
'description',
|
|
'duration',
|
|
'start_date',
|
|
'end_date',
|
|
'price',
|
|
'capacity',
|
|
'views_count',
|
|
'status'
|
|
];
|
|
|
|
public function travelType()
|
|
{
|
|
return $this->belongsTo(TravelType::class);
|
|
}
|
|
|
|
public function flights()
|
|
{
|
|
return $this->belongsToMany(Flight::class, 'tour_flights')
|
|
->withPivot('id')
|
|
->withTimestamps();
|
|
}
|
|
}
|