From 8d0cd16384f58791ec9185b8c608dd9a6d59149b Mon Sep 17 00:00:00 2001 From: mina-esn Date: Thu, 20 Aug 2026 13:01:03 +0330 Subject: [PATCH] refactor(enums): reorganize namespaces and update flight/tour/user imports --- app/Enums/{Admin/Tour => Flight}/TourType.php | 2 +- app/Enums/{Admin => }/Tour/TourMode.php | 2 +- app/Enums/{Admin => }/Tour/TourScope.php | 2 +- app/Enums/{ => User}/UserGender.php | 2 +- app/Enums/{ => User}/UserMarital.php | 2 +- app/Enums/{ => User}/UserStatus.php | 2 +- app/Http/Controllers/Admin/TourController.php | 3 +- .../Controllers/Auth/RegisterController.php | 5 +- .../Requests/Admin/Tour/TourStoreRequest.php | 6 +- .../Requests/Admin/Tour/TourUpdateRequest.php | 6 +- .../Requests/Auth/RegisterPostRequest.php | 4 +- app/Models/Tour.php | 7 +- app/Models/User.php | 8 +- resources/views/admin/tours/create.blade.php | 44 +++++---- resources/views/admin/tours/edit.blade.php | 10 +-- resources/views/auth/register.blade.php | 87 ++++++++++++------ .../views/components/flight-card.blade.php | 87 +++++++++--------- routes/admin.php | 6 +- .../6e84530c00e25f2ca870d5440b8da444.php | 89 +++++++++---------- .../c0862dfa874f43235690340041aae4b8.php | 44 +++++---- 20 files changed, 237 insertions(+), 181 deletions(-) rename app/Enums/{Admin/Tour => Flight}/TourType.php (92%) rename app/Enums/{Admin => }/Tour/TourMode.php (88%) rename app/Enums/{Admin => }/Tour/TourScope.php (89%) rename app/Enums/{ => User}/UserGender.php (77%) rename app/Enums/{ => User}/UserMarital.php (78%) rename app/Enums/{ => User}/UserStatus.php (74%) diff --git a/app/Enums/Admin/Tour/TourType.php b/app/Enums/Flight/TourType.php similarity index 92% rename from app/Enums/Admin/Tour/TourType.php rename to app/Enums/Flight/TourType.php index 6a158d2..3502f91 100644 --- a/app/Enums/Admin/Tour/TourType.php +++ b/app/Enums/Flight/TourType.php @@ -1,6 +1,6 @@ گستره تور * - @foreach(\App\Enums\Admin\Tour\TourMode::cases() as $mode) - @endforeach @@ -92,8 +95,9 @@ @foreach($cities as $city) - @endforeach @@ -125,7 +130,8 @@ + @error('summary') {{ $message }} @enderror @@ -146,7 +153,8 @@
- + @error('description') {{ $message }} @enderror @@ -159,7 +167,8 @@
- + @error('start_date') {{ $message }} @enderror @@ -167,7 +176,8 @@
- + @error('end_date') {{ $message }} @enderror @@ -175,7 +185,8 @@
- + @error('price') {{ $message }} @enderror @@ -183,7 +194,8 @@
- + @error('capacity') {{ $message }} @enderror @@ -238,7 +250,7 @@
@push('scripts') @endpush - - - - @endsection diff --git a/resources/views/components/flight-card.blade.php b/resources/views/components/flight-card.blade.php index 2317fe8..c227945 100644 --- a/resources/views/components/flight-card.blade.php +++ b/resources/views/components/flight-card.blade.php @@ -1,53 +1,52 @@ +
+
+
+ {{ $flight->flight_number }} + @auth +
+ @csrf -
-
-
- {{ $flight->flight_number }} - @auth - - @csrf - - - - @else - +
- +
+

+ {{ $flight->airline?->name ?? 'ایرلاین' }} +

-

- {{ $flight->origin_airport?->city->name ?? 'مبدأ' }} - @if ($flight->trip_type === \App\Enums\FlightTripType::ONEWAY) - - @else - - @endif - {{ $flight->airport?->city->name ?? 'مقصد' }} -

+

+ {{ $flight->origin_airport?->city->name ?? 'مبدأ' }} + @if ($flight->trip_type === \App\Enums\Flight\FlightTripType::ONEWAY) + + @else + + @endif + {{ $flight->airport?->city->name ?? 'مقصد' }} +

-
-
- {{ number_format($flight->price) }} تومان -
- +
+
+ {{ number_format($flight->price) }} تومان +
+
+
diff --git a/routes/admin.php b/routes/admin.php index 11641c5..7ab6461 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -86,8 +86,8 @@ Route::prefix('admin')->name('admin.')->group(function () { Route::get('create', 'create')->name('create'); Route::post('store', 'store')->name('store'); - Route::prefix('trash')->group(function () { - Route::get('/', 'trash')->name('trash'); + Route::prefix('trash')->name('trash.')->group(function () { + Route::get('/', 'trash')->name('index'); Route::prefix('{id}')->group(function () { Route::post('restore', 'restore')->name('restore'); @@ -102,6 +102,8 @@ Route::prefix('admin')->name('admin.')->group(function () { Route::delete('destroy', 'destroy')->name('destroy'); }); }); + + Route::prefix('tours')->name('tours.')->middleware('admin.permission:manage-tours')->controller(TourController::class)->group(function () { Route::get('/', 'index')->name('index'); diff --git a/storage/framework/views/6e84530c00e25f2ca870d5440b8da444.php b/storage/framework/views/6e84530c00e25f2ca870d5440b8da444.php index 2917c4e..80610dc 100644 --- a/storage/framework/views/6e84530c00e25f2ca870d5440b8da444.php +++ b/storage/framework/views/6e84530c00e25f2ca870d5440b8da444.php @@ -1,56 +1,55 @@ +
+
+
+ <?php echo e($flight->flight_number); ?> + guard()->check()): ?> +
+ -
-
-
- <?php echo e($flight->flight_number); ?> - guard()->check()): ?> - - - - - - - + + + + + + + +
+
+

+ airline?->name ?? 'ایرلاین'); ?> +

+ +

+ origin_airport?->city->name ?? 'مبدأ'); ?> + + trip_type === \App\Enums\Flight\FlightTripType::ONEWAY): ?> + + + -

-
-

- airline?->name ?? 'ایرلاین'); ?> -

+ airport?->city->name ?? 'مقصد'); ?> -

- origin_airport?->city->name ?? 'مبدأ'); ?> +

- trip_type === \App\Enums\FlightTripType::ONEWAY): ?> - - - - - airport?->city->name ?? 'مقصد'); ?> - -

- -
-
- price)); ?> تومان -
- +
+
+ price)); ?> تومان +
+
+
\ No newline at end of file diff --git a/storage/framework/views/c0862dfa874f43235690340041aae4b8.php b/storage/framework/views/c0862dfa874f43235690340041aae4b8.php index b5a18ab..a94a523 100644 --- a/storage/framework/views/c0862dfa874f43235690340041aae4b8.php +++ b/storage/framework/views/c0862dfa874f43235690340041aae4b8.php @@ -56,8 +56,9 @@ unset($__errorArgs, $__bag); ?> - addLoop($__currentLoopData); foreach($__currentLoopData as $mode): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> - @@ -113,8 +116,9 @@ unset($__errorArgs, $__bag); ?> addLoop($__currentLoopData); foreach($__currentLoopData as $city): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> - @@ -162,7 +167,8 @@ unset($__errorArgs, $__bag); ?> + getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : @@ -198,7 +205,8 @@ unset($__errorArgs, $__bag); ?>
- + getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : @@ -218,7 +226,8 @@ unset($__errorArgs, $__bag); ?>
- + getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : @@ -233,7 +242,8 @@ unset($__errorArgs, $__bag); ?>
- + getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : @@ -248,7 +258,8 @@ unset($__errorArgs, $__bag); ?>
- + getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : @@ -263,7 +274,8 @@ unset($__errorArgs, $__bag); ?>
- + getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : @@ -332,7 +344,7 @@ unset($__errorArgs, $__bag); ?>
startPush('scripts'); ?>