feat: update user and flight models and add comment and admin models
This commit is contained in:
+32
-28
@@ -34,24 +34,28 @@ use Illuminate\Database\Eloquent\Model;
|
||||
*/
|
||||
class Tour extends Model
|
||||
{
|
||||
protected $table = 'tours';
|
||||
public static $snakeAttributes = false;
|
||||
protected $table = 'tours';
|
||||
public static $snakeAttributes = false;
|
||||
|
||||
protected $casts = [
|
||||
'origin_city_id' => 'int',
|
||||
'destination_city_id' => 'int',
|
||||
'file_id' => 'int'
|
||||
];
|
||||
protected $casts = [
|
||||
'origin_city_id' => 'int',
|
||||
'destination_city_id' => 'int',
|
||||
'file_id' => 'int',
|
||||
'tour_mode'=> 'int',
|
||||
'tour_scope' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'summary',
|
||||
'description',
|
||||
'origin_city_id',
|
||||
'destination_city_id',
|
||||
'file_id',
|
||||
'tour_type'
|
||||
];
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'summary',
|
||||
'description',
|
||||
'origin_city_id',
|
||||
'destination_city_id',
|
||||
'file_id',
|
||||
'tour_type',
|
||||
'tour_mode',
|
||||
'tour_scope'
|
||||
];
|
||||
#[Scope]
|
||||
protected function applySort(Builder $query, ?string $sort = null): void
|
||||
{
|
||||
@@ -73,27 +77,27 @@ class Tour extends Model
|
||||
}
|
||||
}
|
||||
|
||||
public function flight()
|
||||
{
|
||||
return $this->belongsTo(Flight::class, 'file_id');
|
||||
}
|
||||
public function originCity()
|
||||
{
|
||||
return $this->belongsTo(City::class, 'origin_city_id');
|
||||
}
|
||||
|
||||
public function city()
|
||||
{
|
||||
return $this->belongsTo(City::class, 'destination_city_id');
|
||||
}
|
||||
public function city()
|
||||
{
|
||||
return $this->belongsTo(City::class, 'destination_city_id');
|
||||
}
|
||||
|
||||
public function tourDepartures()
|
||||
{
|
||||
return $this->hasMany(TourDeparture::class , 'tour_id');
|
||||
}
|
||||
public function tourDepartures()
|
||||
{
|
||||
return $this->hasMany(TourDeparture::class , 'tour_id');
|
||||
}
|
||||
|
||||
public function file()
|
||||
{
|
||||
return $this->belongsTo(File::class, 'file_id');
|
||||
}
|
||||
public function comments()
|
||||
{
|
||||
return $this->hasMany(Comment::class, 'tour_id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user