diff --git a/bootstrap/app.php b/bootstrap/app.php index 62d3729..f19ea8e 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -3,11 +3,13 @@ use Illuminate\Foundation\Application; use Illuminate\Foundation\Configuration\Exceptions; use Illuminate\Foundation\Configuration\Middleware; +use Illuminate\Http\Request; return Application::configure(basePath: dirname(__DIR__)) ->withRouting( web: [__DIR__ . '/../routes/web.php', __DIR__ . '/../routes/auth.php', + __DIR__ . '/../routes/admin.php', ], commands: __DIR__.'/../routes/console.php', @@ -15,8 +17,24 @@ return Application::configure(basePath: dirname(__DIR__)) ) ->withMiddleware(function (Middleware $middleware): void { - $middleware->redirectGuestsTo(fn(Illuminate\Http\Request $request) => route('auth.login.index')); - $middleware->redirectUsersTo(fn(Illuminate\Http\Request $request) => route('index')); + $middleware->redirectGuestsTo(function (Request $request) { + + if ($request->routeIs('admin.*')) { + return route('admin.auth.login.index'); + } + + return route('auth.login.index'); + }); + + $middleware->redirectUsersTo(function (Request $request) { + + if ($request->routeIs('admin.*')) { + return route('admin.dashboard.index'); + } + + return route('index'); + }); + }) ->withExceptions(function (Exceptions $exceptions): void { // diff --git a/config/auth.php b/config/auth.php index 3a06e62..0531989 100644 --- a/config/auth.php +++ b/config/auth.php @@ -42,6 +42,10 @@ return [ 'driver' => 'session', 'provider' => 'users', ], + 'admin' => [ + 'driver' => 'session', + 'provider' => 'admins', + ], ], /* @@ -66,6 +70,10 @@ return [ 'driver' => 'eloquent', 'model' => User::class, ], + 'admins' => [ + 'driver' => 'eloquent', + 'model' => \App\Models\Admin::class, + ], // 'users' => [ // 'driver' => 'database', diff --git a/resources/views/show-layouts/sidebar.blade.php b/resources/views/show-layouts/sidebar.blade.php index 8f4de99..0dd3647 100644 --- a/resources/views/show-layouts/sidebar.blade.php +++ b/resources/views/show-layouts/sidebar.blade.php @@ -15,21 +15,14 @@ - @if($type === 'tour') -
- -
-
-
مدت تور
- {{ $item->duration }} روز و @@ -38,17 +31,12 @@
- -
-
-
مسیر تور
- {{ $item->origin }} @@ -57,11 +45,8 @@ {{ $item->destination }}
-
-
-
@@ -74,15 +59,11 @@ بازدید
-
-
-
-
تاریخ ثبت تور
@@ -94,30 +75,44 @@
-
- اکنون رزرو کن - افزودن به علاقه‌مندی‌ها
- @endif - @if($type === 'flight') -
+
- + @csrf - @csrf + + + + + + + +
@@ -139,7 +134,6 @@ - +
-
+ @endif - - {{-- تعداد بازدید --}}
diff --git a/routes/web.php b/routes/web.php index e8cd9a5..5b6a15d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -60,7 +60,11 @@ Route::prefix('account')->name('account.')->middleware('auth')->group(function ( Route::get('comments', [CommentStatusController::class, 'index']) ->name('comments'); - Route::get('booking', [BookingController::class, 'index'])->name('booking'); + Route::post('booking', [BookingController::class, 'store']) + ->name('booking.store'); + + Route::get('booking', [BookingController::class, 'index']) + ->name('booking'); });