diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php index 29f976a..561cf55 100644 --- a/app/Http/Controllers/IndexController.php +++ b/app/Http/Controllers/IndexController.php @@ -2,6 +2,8 @@ namespace App\Http\Controllers; +use App\Models\Flight; +use App\Models\Tour; use Illuminate\Http\Request; class IndexController extends Controller @@ -10,6 +12,12 @@ class IndexController extends Controller public function index() { $title = 'صفحه اصلی'; - return view('index' , compact('title')); + $flights = Flight::with('file') + ->orderByDesc('created_at') + ->paginate(4); + + + + return view('index' , compact('title' , 'flights')); } } diff --git a/resources/views/components/flight-card.blade.php b/resources/views/components/flight-card.blade.php new file mode 100644 index 0000000..5b3f859 --- /dev/null +++ b/resources/views/components/flight-card.blade.php @@ -0,0 +1,35 @@ + +
+ {{ $flight->origin_airport?->city->name ?? 'مبدأ' }} + @if ($flight->trip_type === \App\Enums\FlightTripType::ONEWAY) + + @else + + @endif + {{ $flight->airport?->city->name ?? 'مقصد' }} +
+ +