fix:edit models
This commit is contained in:
+13
-2
@@ -14,10 +14,11 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $city
|
* @property int $city_id
|
||||||
* @property string $country
|
* @property string $country
|
||||||
* @property string $code
|
* @property string $code
|
||||||
*
|
*
|
||||||
|
* @property City $city
|
||||||
* @property Collection|Flight[] $flights
|
* @property Collection|Flight[] $flights
|
||||||
*
|
*
|
||||||
* @package App\Models
|
* @package App\Models
|
||||||
@@ -26,14 +27,24 @@ class Airport extends Model
|
|||||||
{
|
{
|
||||||
protected $table = 'airports';
|
protected $table = 'airports';
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
public static $snakeAttributes = false;
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'city_id' => 'int'
|
||||||
|
];
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'city',
|
'city_id',
|
||||||
'country',
|
'country',
|
||||||
'code'
|
'code'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function city()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(City::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function flights()
|
public function flights()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Flight::class, 'departure_airport_id');
|
return $this->hasMany(Flight::class, 'departure_airport_id');
|
||||||
|
|||||||
+13
-6
@@ -6,12 +6,13 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Enums\BookingStatus;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Booking
|
* Class Booking
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property int $flight_id
|
* @property int $flight_id
|
||||||
@@ -23,8 +24,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
* @property int $status
|
* @property int $status
|
||||||
* @property Carbon $created_ar
|
* @property Carbon $created_ar
|
||||||
* @property Carbon $updated_at
|
* @property Carbon $updated_at
|
||||||
*
|
*
|
||||||
* @property Flight $flight
|
* @property Flight $flights
|
||||||
* @property TourDate $tour_date
|
* @property TourDate $tour_date
|
||||||
* @property User $user
|
* @property User $user
|
||||||
*
|
*
|
||||||
@@ -42,8 +43,8 @@ class Booking extends Model
|
|||||||
'adult_count' => 'int',
|
'adult_count' => 'int',
|
||||||
'child_count' => 'int',
|
'child_count' => 'int',
|
||||||
'total_price' => 'int',
|
'total_price' => 'int',
|
||||||
'status' => 'int',
|
'status' => BookingStatus::class,
|
||||||
'created_ar' => 'datetime'
|
'created_at' => 'datetime'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@@ -55,7 +56,8 @@ class Booking extends Model
|
|||||||
'total_price',
|
'total_price',
|
||||||
'tracking_code',
|
'tracking_code',
|
||||||
'status',
|
'status',
|
||||||
'created_ar'
|
'created_at',
|
||||||
|
'updated_at'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function flight()
|
public function flight()
|
||||||
@@ -72,4 +74,9 @@ class Booking extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function passengers()
|
||||||
|
{
|
||||||
|
return $this->hasMany(BookingPassenger::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,13 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Enums\PassengerType;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BookingPassenger
|
* Class BookingPassenger
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $booking_id
|
* @property int $booking_id
|
||||||
* @property string $first_name
|
* @property string $first_name
|
||||||
@@ -32,8 +33,8 @@ class BookingPassenger extends Model
|
|||||||
protected $casts = [
|
protected $casts = [
|
||||||
'booking_id' => 'int',
|
'booking_id' => 'int',
|
||||||
'birth_date' => 'datetime',
|
'birth_date' => 'datetime',
|
||||||
'passenger_type' => 'int',
|
'passenger_type' => PassengerType::class,
|
||||||
'created_ar' => 'datetime'
|
'created_at' => 'datetime'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@@ -43,6 +44,12 @@ class BookingPassenger extends Model
|
|||||||
'national_code',
|
'national_code',
|
||||||
'birth_date',
|
'birth_date',
|
||||||
'passenger_type',
|
'passenger_type',
|
||||||
'created_ar'
|
'created_at',
|
||||||
|
'updated_at'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function booking()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Booking::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-5
@@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Tour
|
* Class Tour
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $title
|
* @property string $title
|
||||||
* @property string $summary
|
* @property string $summary
|
||||||
@@ -22,9 +22,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
* @property int|null $file_id
|
* @property int|null $file_id
|
||||||
* @property int $duration
|
* @property int $duration
|
||||||
* @property int $status
|
* @property int $status
|
||||||
* @property Carbon $created_ar
|
* @property Carbon $created_at
|
||||||
* @property Carbon $updated_at
|
* @property Carbon $updated_at
|
||||||
*
|
*
|
||||||
* @property File|null $file
|
* @property File|null $file
|
||||||
* @property Collection|TourDate[] $tour_dates
|
* @property Collection|TourDate[] $tour_dates
|
||||||
*
|
*
|
||||||
@@ -38,8 +38,9 @@ class Tour extends Model
|
|||||||
protected $casts = [
|
protected $casts = [
|
||||||
'file_id' => 'int',
|
'file_id' => 'int',
|
||||||
'duration' => 'int',
|
'duration' => 'int',
|
||||||
|
'views' => 'int',
|
||||||
'status' => 'int',
|
'status' => 'int',
|
||||||
'created_ar' => 'datetime'
|
'created_at' => 'datetime'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@@ -50,8 +51,9 @@ class Tour extends Model
|
|||||||
'destination',
|
'destination',
|
||||||
'file_id',
|
'file_id',
|
||||||
'duration',
|
'duration',
|
||||||
|
'views',
|
||||||
'status',
|
'status',
|
||||||
'created_ar'
|
'created_at'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function file()
|
public function file()
|
||||||
@@ -63,4 +65,8 @@ class Tour extends Model
|
|||||||
{
|
{
|
||||||
return $this->hasMany(TourDate::class);
|
return $this->hasMany(TourDate::class);
|
||||||
}
|
}
|
||||||
|
public function comments()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Comment::class, 'tour_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-3
@@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Enums\UserGenderStatus;
|
||||||
|
use App\Enums\UserMaritalStatus;
|
||||||
|
use App\Enums\UserStatus;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
@@ -47,12 +50,12 @@ class User extends Authenticated
|
|||||||
public static $snakeAttributes = false;
|
public static $snakeAttributes = false;
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'gender' => 'int',
|
'gender' => UserGenderStatus::class,
|
||||||
'marital_status' => 'int',
|
'marital_status' => UserMaritalStatus::class,
|
||||||
'file_id' => 'int',
|
'file_id' => 'int',
|
||||||
'province_id' => 'int',
|
'province_id' => 'int',
|
||||||
'city_id' => 'int',
|
'city_id' => 'int',
|
||||||
'status' => 'int',
|
'status' => UserStatus::class,
|
||||||
'deleted' => 'datetime'
|
'deleted' => 'datetime'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user