feat: update models and relationships

This commit is contained in:
2026-08-17 09:59:20 +03:30
parent f726c41ba0
commit f137797e3b
3 changed files with 47 additions and 9 deletions
+12 -3
View File
@@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
/**
* Class Tour
*
*
* @property int $id
* @property string $title
* @property string $summary
@@ -23,7 +23,7 @@ use Illuminate\Database\Eloquent\Model;
* @property string $tour_type
* @property Carbon $created_at
* @property Carbon $updated_at
*
*
* @property Flight $flight
* @property City $city
* @property Collection|TourDeparture[] $tourDepartures
@@ -55,6 +55,10 @@ class Tour extends Model
{
return $this->belongsTo(Flight::class, 'file_id');
}
public function originCity()
{
return $this->belongsTo(City::class, 'origin_city_id');
}
public function city()
{
@@ -63,6 +67,11 @@ class Tour extends Model
public function tourDepartures()
{
return $this->hasMany(TourDeparture::class);
return $this->hasMany(TourDeparture::class , 'tour_id');
}
public function file()
{
return $this->belongsTo(File::class, 'file_id');
}
}