From b14da0173168205dc0f4f100148402f79c053ceb Mon Sep 17 00:00:00 2001 From: Admin Date: Mon, 17 Aug 2026 13:05:34 -0700 Subject: [PATCH] feat: complete flight index blade --- app/Enums/PassengerType.php | 9 + app/Models/Flight.php | 30 +- resources/views/flights/index.blade.php | 383 ++++++++++++++++++++++++ 3 files changed, 420 insertions(+), 2 deletions(-) create mode 100644 app/Enums/PassengerType.php create mode 100644 resources/views/flights/index.blade.php diff --git a/app/Enums/PassengerType.php b/app/Enums/PassengerType.php new file mode 100644 index 0000000..0a2df41 --- /dev/null +++ b/app/Enums/PassengerType.php @@ -0,0 +1,9 @@ + 'int', 'price' => 'float', 'capacity' => 'int', + 'views' => 'int', 'status' => 'int' ]; @@ -64,6 +67,7 @@ class Flight extends Model 'summary', 'capacity', 'description', + 'views', 'status' ]; @@ -86,4 +90,26 @@ class Flight extends Model { return $this->hasMany(Booking::class); } + public function arrivalAirport() + { + return $this->belongsTo(Airport::class, 'arrival_airport_id'); + } + public function departureAirport() + { + return $this->belongsTo(Airport::class, 'departure_airport_id'); + } + public function comments() + { + return $this->hasMany(Comment::class, 'flight_id'); + } + + #[Scope] + protected function applyFilter(Builder $query): void + { + $request = request(); + + if ($request->filled('flight_type')) { + $query->where('flight_type', $request->input('flight_type')); + } + } } diff --git a/resources/views/flights/index.blade.php b/resources/views/flights/index.blade.php new file mode 100644 index 0000000..131eae0 --- /dev/null +++ b/resources/views/flights/index.blade.php @@ -0,0 +1,383 @@ +@extends('layouts.app') + +@section('content') +
+ + + +
+
+
+ + + +
+
+
+ + +
+
+
+ +
+
+
+
+

نوع پرواز

+ +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+
+ +
+
+
+
+
+
+ +
+
+
+
{{ $flights->total() }} نتیجه پیداشد
+
+ +
+
+
+
+ + @forelse($flights as $flight) + @include('components.flight') + @empty +
+
+ +

پروازی یافت نشد

+

در حال حاضر هیچ پروازی برای نمایش وجود ندارد.

+
+
+ @endforelse + + {{ $flights->links() }} + +
+
+
+
+
+ +
+@endsection