feat: add scope/type enums, update Flight model, and organize enums
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums\Flight;
|
||||||
|
|
||||||
|
enum FlightScope:int
|
||||||
|
{
|
||||||
|
case Domestic = 1;
|
||||||
|
case International = 2;
|
||||||
|
|
||||||
|
public function label(): string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::Domestic => 'داخلی',
|
||||||
|
self::International => 'خارجی',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Enums;
|
namespace App\Enums\Flight;
|
||||||
|
|
||||||
enum FlightStatus:int
|
enum FlightStatus:int
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Enums;
|
namespace App\Enums\Flight;
|
||||||
|
|
||||||
enum FlightTripType: int
|
enum FlightTripType: int
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums\Flight;
|
||||||
|
|
||||||
|
enum FlightType:int
|
||||||
|
{
|
||||||
|
case Systematic = 1;
|
||||||
|
case Charter = 2;
|
||||||
|
|
||||||
|
public function label(): string
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::Systematic => 'سیستمی',
|
||||||
|
self::Charter => 'چارتر',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,8 +6,10 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Enums\FlightStatus;
|
use App\Enums\Flight\FlightScope;;
|
||||||
use App\Enums\FlightTripType;
|
use App\Enums\Flight\FlightStatus;
|
||||||
|
use App\Enums\Flight\FlightTripType;
|
||||||
|
use App\Enums\Flight\FlightType;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Hekmatinasser\Verta\Verta;
|
use Hekmatinasser\Verta\Verta;
|
||||||
use Illuminate\Database\Eloquent\Attributes\Scope;
|
use Illuminate\Database\Eloquent\Attributes\Scope;
|
||||||
@@ -54,6 +56,8 @@ class Flight extends Model
|
|||||||
'capacity' => 'int',
|
'capacity' => 'int',
|
||||||
'status' => FlightStatus::class,
|
'status' => FlightStatus::class,
|
||||||
'trip_type' => FlightTripType::class,
|
'trip_type' => FlightTripType::class,
|
||||||
|
'flight_scope'=> FlightScope::class,
|
||||||
|
'flight_type', FlightType::class,
|
||||||
'views_count' => 'int'
|
'views_count' => 'int'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -68,6 +72,8 @@ class Flight extends Model
|
|||||||
'capacity',
|
'capacity',
|
||||||
'status',
|
'status',
|
||||||
'trip_type',
|
'trip_type',
|
||||||
|
'flight_scope',
|
||||||
|
'flight_type',
|
||||||
'views_count'
|
'views_count'
|
||||||
];
|
];
|
||||||
#[Scope]
|
#[Scope]
|
||||||
|
|||||||
Reference in New Issue
Block a user