feat: add FlightImage model and update Flight image relation
This commit is contained in:
@@ -156,5 +156,16 @@ class Flight extends Model
|
||||
{
|
||||
return $this->hasMany(Favorite::class);
|
||||
}
|
||||
public function images()
|
||||
{
|
||||
return $this->hasMany(FlightImage::class)
|
||||
->orderBy('sort_order');
|
||||
}
|
||||
|
||||
public function coverImage()
|
||||
{
|
||||
return $this->hasOne(FlightImage::class)
|
||||
->where('is_default', true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user