'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(); } // در فایل App\Models\Tour.php و App\Models\Flight.php public function comments() { return $this->morphMany(Comment::class, 'commentable'); } protected static function booted() { static::creating(function ($tour) { // اگر مقداری تعیین نشده بود، پیش‌فرض‌ها را اعمال کن if (is_null($tour->views_count)) { $tour->views_count = 0; } if (is_null($tour->status)) { $tour->status = 0; // فرض بر اینکه 0 یعنی غیرفعال/پیش‌نویس } }); } }