fix: regenerate models and add database

This commit is contained in:
2026-08-16 08:06:57 +03:30
parent 8fa8d82c29
commit ff69c76dc4
11 changed files with 264 additions and 59 deletions
+25 -15
View File
@@ -14,16 +14,15 @@ use Illuminate\Database\Eloquent\Model;
* Class Flight
*
* @property int $id
* @property int $arrival_aiport_id
* @property int $departure_airport_id
* @property int $airline_id
* @property int $file_id
* @property string $title
* @property string $summary
* @property int $arrival_aiport_id
* @property int $file_id
* @property int $flight_type
* @property int $departure_time
* @property Carbon $departure_time
* @property float $price
* @property int $deprature_airport_id
* @property string $destination
* @property int $airline_id
* @property int $capacity
* @property int $status
* @property Carbon $created_at
@@ -33,6 +32,8 @@ use Illuminate\Database\Eloquent\Model;
* @property File $file
* @property Airport $airport
* @property Collection|Booking[] $bookings
* @property Collection|Comment[] $comments
* @property Collection|Favorite[] $favorites
*
* @package App\Models
*/
@@ -43,27 +44,26 @@ class Flight extends Model
protected $casts = [
'arrival_aiport_id' => 'int',
'departure_airport_id' => 'int',
'airline_id' => 'int',
'file_id' => 'int',
'flight_type' => 'int',
'departure_time' => 'int',
'departure_time' => 'datetime',
'price' => 'float',
'deprature_airport_id' => 'int',
'airline_id' => 'int',
'capacity' => 'int',
'status' => 'int'
];
protected $fillable = [
'arrival_aiport_id',
'departure_airport_id',
'airline_id',
'file_id',
'title',
'summary',
'arrival_aiport_id',
'file_id',
'flight_type',
'departure_time',
'price',
'deprature_airport_id',
'destination',
'airline_id',
'capacity',
'status'
];
@@ -80,11 +80,21 @@ class Flight extends Model
public function airport()
{
return $this->belongsTo(Airport::class, 'deprature_airport_id');
return $this->belongsTo(Airport::class, 'departure_airport_id');
}
public function bookings()
{
return $this->hasMany(Booking::class);
}
public function comments()
{
return $this->hasMany(Comment::class);
}
public function favorites()
{
return $this->hasMany(Favorite::class);
}
}