git commit "update flight page"

This commit is contained in:
2026-08-17 10:01:42 +03:30
parent b626644eea
commit e99c340f1e
21 changed files with 13624 additions and 10781 deletions
+5 -9
View File
@@ -3,19 +3,15 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\City; use App\Models\City;
use Illuminate\Http\Request;
class CityController extends Controller class CityController extends Controller
{ {
// public function byProvince(int $province)
public function getCities($province)
{ {
$cities = City::where('provinces', $province)
$cities = City::where('province_id',$province)
->orderBy('name') ->orderBy('name')
->get(); ->get(['id', 'name']);
return response()->json($cities); return response()->json($cities);
}
}} }
+14 -14
View File
@@ -2,29 +2,29 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Requests\FlightSearchRequest;
use App\Models\Flight; use App\Models\Flight;
use Illuminate\Http\Request;
class FlightController extends Controller class FlightController extends Controller
{ {
public function search(FlightSearchRequest $request) public function index()
{ {
$filters = $request->validated(); $newestFlight = Flight::
latest()
$flights = Flight::query() ->applySearch()
->applySearch($filters) ->take(10)
->get(); ->get();
$flights = Flight::latest()->
paginate(9);
return view('flights.search', compact('flights')); return view('home.index', compact('newestFlight', 'flights'));
} }
public function archive() public function show(Flight $flight)
{ {
$flights = Flight::query() $flight->increment('views');
->latest()
->paginate(12);
return view('flights.archive', compact('flights'));
return view('flights.show', compact('flight'));
} }
}
}
+5 -8
View File
@@ -4,19 +4,16 @@ namespace App\Http\Controllers;
use App\Models\Flight; use App\Models\Flight;
use App\Models\Tour; use App\Models\Tour;
use App\Models\Province;
class HomeController extends Controller class HomeController extends Controller
{ {
public function index() public function index()
{ {
$flights = Flight::latest('created_at') $newestFlight = Flight::latest()->take(10)->get();
->take(6) $flights=Flight::latest()->paginate(5);
->get(); $newestTour = Tour::latest()->take(10)->get();
$tours = Tour::latest('created_at') return view('home.index', compact('newestFlight','flights', 'newestTour'));
->take(6)
->get();
return view('home.index', compact('flights', 'tours'));
} }
} }
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers;
use App\Models\Tour;
class TourController extends Controller
{
// صفحه لیست تورها: اسلایدر آخرین‌ها + گرید صفحه‌بندی‌شده
public function index()
{
$newestTour = Tour::latest()->take(10)->get();
$tours = Tour::latest()->paginate(9);
return view('tours.index', compact('newestTour', 'tours'));
}
// جزئیات تور + شمارنده بازدید
public function show(Tour $tour)
{
$tour->increment('views');
return view('tours.show', compact('tour'));
}
}
+1 -2
View File
@@ -41,8 +41,7 @@ class RegisterPostRequest extends FormRequest
'national_code' => [ 'national_code' => [
'required', 'required',
'unique:users,national_code', 'unique:users,national_code',
'ir_national_id' ],
],
'gender' => [ 'gender' => [
'required', 'required',
+4
View File
@@ -25,6 +25,8 @@ use Illuminate\Database\Eloquent\Model;
* @property string|null $flight_class * @property string|null $flight_class
* @property int|null $capacity * @property int|null $capacity
* @property float|null $price * @property float|null $price
* @property string|null $image
* @property string|null $views
* @property int|null $status * @property int|null $status
* @property Carbon|null $created_at * @property Carbon|null $created_at
* @property Carbon|null $updated_at * @property Carbon|null $updated_at
@@ -56,6 +58,8 @@ class Flight extends Model
'flight_class', 'flight_class',
'capacity', 'capacity',
'price', 'price',
'image',
'views',
'status' 'status'
]; ];
+13165 -10394
View File
File diff suppressed because it is too large Load Diff
+157
View File
@@ -0,0 +1,157 @@
<style>
.flight-detail-page {
padding: 70px 0;
background: #f5f7fb;
direction: rtl;
}
.flight-detail-card {
background: #fff;
border-radius: 25px;
overflow: hidden;
display: flex;
gap: 0;
box-shadow: 0 15px 50px rgba(0,0,0,.12);
}
.flight-detail-image {
width: 40%;
min-height: 450px;
}
.flight-detail-image img {
width: 100%;
height: 100%;
object-fit: cover;
}
.flight-detail-content {
width: 60%;
padding: 45px;
}
.flight-detail-content h1 {
font-size: 34px;
font-weight: 800;
color: #102a43;
margin: 0;
}
.flight-badge-show {
background: #1976d2;
color: white;
padding: 8px 22px;
border-radius: 50px;
font-size: 14px;
}
.route-box {
margin: 35px 0;
padding: 25px;
border-radius: 20px;
background: #f8fafc;
display: flex;
align-items: center;
justify-content: space-around;
}
.route-box div {
text-align: center;
}
.route-box small {
display: block;
color: #78909c;
margin-bottom: 8px;
}
.route-box strong {
font-size: 22px;
color: #102a43;
}
.route-line {
font-size: 30px;
color: #f4b400;
}
.flight-info-grid {
display: grid;
grid-template-columns: repeat(2,1fr);
gap: 20px;
margin-bottom: 35px;
}
.flight-info-grid div {
background: #f8fafc;
padding: 18px;
border-radius: 15px;
}
.flight-info-grid span {
display:block;
color:#78909c;
font-size:13px;
margin-bottom:8px;
}
.flight-info-grid b {
font-size:18px;
color:#102a43;
}
.buy-flight-btn {
display:inline-block;
width:100%;
text-align:center;
background:#1976d2;
color:white;
padding:15px;
border-radius:15px;
text-decoration:none;
font-weight:700;
transition:.3s;
}
.buy-flight-btn:hover {
background:#125ca8;
color:white;
}
@media(max-width:768px){
.flight-detail-card{
flex-direction:column;
}
.flight-detail-image,
.flight-detail-content{
width:100%;
}
.flight-detail-image{
height:280px;
}
.flight-info-grid{
grid-template-columns:1fr;
}
}
</style>
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

+25 -107
View File
@@ -1,129 +1,47 @@
@foreach($flights as $flight) <div class="col-md-4">
<!-- FLIGHT ITEM --> <div class="card border-0 shadow-sm rounded-4 overflow-hidden h-100">
<div class="swiper-slide flight-card group">
<!-- flight header --> <div class="flight-image">
<div class="flight-card_header">
<div> <img src="{{ asset($flight->image) }}"
<span class="flight-airline"> alt="{{ $flight->airline }}">
{{ $flight->airline }}
</span>
<span class="flight-number"> <span class="flight-badge">
{{ $flight->flight_number }} پرواز
</span> </span>
</div>
@if($flight->flight_class)
<span class="flight-class">
{{ $flight->flight_class }}
</span>
@endif
</div> </div>
<!-- flight route --> <div class="card-body d-flex flex-column">
<div class="flight-card_route">
<div class="flight-airport"> <h5 class="fw-bold">
{{ $flight->airline }}
</h5>
<span>
مبدا
</span>
<strong> <div class="route">
{{ $flight->origin }} <span>{{ $flight->origin }}</span>
</strong>
<span class="line"></span>
<span>{{ $flight->destination }}</span>
</div> </div>
<div class="flight-route-line"> <div class="mt-auto d-flex justify-content-between align-items-center">
✈
</div>
<div class="flight-airport">
<span>
مقصد
</span>
<strong> <strong>
{{ $flight->destination }} {{ number_format($flight->price) }} تومان
</strong> </strong>
<a href="{{ route('flights.show',$flight) }}"
class="btn btn-primary rounded-pill">
مشاهده
</a>
</div> </div>
</div> </div>
</div></div>
<!-- flight details -->
<div class="flight-card_details">
<div>
<span>
تاریخ پرواز
</span>
<strong>
{{ $flight->departure_date?->format('Y/m/d') }}
</strong>
</div>
<div>
<span>
ساعت حرکت
</span>
<strong>
{{ $flight->departure_time?->format('H:i') }}
</strong>
</div>
<div>
<span>
ساعت رسیدن
</span>
<strong>
{{ $flight->arrival_time?->format('H:i') }}
</strong>
</div>
</div>
<!-- flight footer -->
<div class="flight-card_footer">
<div class="flight-price">
<span>
قیمت
</span>
<strong>
{{ number_format($flight->price) }}
<small>
تومان
</small>
</strong>
</div>
<a href="#" class="flight-detail-button">
جزئیات
</a>
</div>
</div>
@endforeach
+32 -63
View File
@@ -1,74 +1,43 @@
@foreach($tours as $tour) <div class="swiper-slide">
<!-- TOUR ITEM --> <div class="card border-0 shadow-sm rounded-4 overflow-hidden h-100">
<div class="swiper-slide tour-card group">
<!-- tour image --> <div class="position-relative" style="height: 170px;">
<a href="#"> @if($tour->image)
<img src="{{ asset('storage/'.$tour->image) }}"
class="w-100 h-100 object-fit-cover"
alt="{{ $tour->title }}">
@else
<div class="w-100 h-100 bg-light"></div>
@endif
<img <span class="position-absolute top-0 end-0 m-2 badge rounded-pill" style="background: var(--teal);">
class="tour-card_img" تور
src="{{ $tour->image ?? asset('assets/img/placeholder.jpg') }}" </span>
alt="{{ $tour->title }}" </div>
>
</a> <div class="card-body d-flex flex-column">
<h5 class="card-title fw-bold fs-6 mb-2">{{ $tour->title }}</h5>
<!-- tour content --> @if($tour->summary)
<div class="tour-card_content"> <p class="text-secondary small mb-3">{{ \Illuminate\Support\Str::limit($tour->summary, 70) }}</p>
@endif
<!-- title --> <div class="small text-secondary mb-3">
<a href="#" class="tour-card_title"> <i class="bi bi-calendar-event"></i>
{{ $tour->title }} تاریخ حرکت: {{ optional($tour->departure_date)->format('Y/m/d') }}
</a> </div>
<!-- destination --> <div class="mt-auto d-flex justify-content-between align-items-center">
<div class="tour-card_destination"> <span class="fw-bold" style="color: var(--blue);">
{{ number_format($tour->price) }} تومان
<span>
📍
</span> </span>
<a href="{{ route('tours.show', $tour) }}"
{{ $tour->destination }} class="btn btn-sm rounded-pill px-3 text-white"
style="background: var(--blue);">
مشاهده
</a>
</div> </div>
<!-- details -->
<div class="tour-card_details">
<div>
<span>مدت تور</span>
<strong>
{{ $tour->duration }} روز
</strong>
</div>
<div>
<span>ظرفیت</span>
<strong>
{{ $tour->capacity }} نفر
</strong>
</div>
</div>
<!-- price -->
<div class="tour-card_price">
<span>
شروع قیمت از
</span>
<strong>
{{ number_format($tour->price) }}
<small>تومان</small>
</strong>
</div>
</div> </div>
</div> </div>
</div>
@endforeach
-35
View File
@@ -1,35 +0,0 @@
@extends('layouts.app')
@section('content')
<div class="container">
<h2>آرشیو پروازها</h2>
@foreach($flights as $flight)
<div>
{{ $flight->airline }}
-
{{ $flight->flight_number }}
<br>
{{ $flight->origin }}
→
{{ $flight->destination }}
<br>
{{ $flight->departure_date }}
</div>
<hr>
@endforeach
{{ $flights->links() }}
</div>
@endsection
-136
View File
@@ -1,136 +0,0 @@
@extends('layouts.app')
@section('content')
<div class="theme-page-section _pt-100 _pb-100">
<div class="container">
<div class="theme-search-results">
<div class="theme-search-results-header">
<h2>نتایج جستجوی پرواز</h2>
<p>
{{ $flights->count() }} پرواز پیدا شد
</p>
</div>
@forelse($flights as $flight)
<div class="theme-search-results-item">
<div class="row">
{{-- ایرلاین --}}
<div class="col-md-2">
<strong>
{{ $flight->airline }}
</strong>
<div>
{{ $flight->flight_number }}
</div>
</div>
{{-- مبدا --}}
<div class="col-md-2 text-center">
<strong>
{{ $flight->origin }}
</strong>
<div>
{{ $flight->departure_time }}
</div>
</div>
{{-- مسیر --}}
<div class="col-md-2 text-center">
<span>
→
</span>
</div>
{{-- مقصد --}}
<div class="col-md-2 text-center">
<strong>
{{ $flight->destination }}
</strong>
<div>
{{ $flight->arrival_time }}
</div>
</div>
{{-- کلاس --}}
<div class="col-md-2 text-center">
<div>
کلاس:
{{ $flight->flight_class }}
</div>
<div>
ظرفیت:
{{ $flight->capacity }}
</div>
</div>
{{-- قیمت --}}
<div class="col-md-2 text-center">
<strong>
{{ number_format($flight->price) }}
</strong>
<div>
تومان
</div>
<button class="btn btn-primary">
انتخاب پرواز
</button>
</div>
</div>
</div>
@empty
<div class="text-center">
<h3>
پروازی پیدا نشد
</h3>
<p>
لطفاً مبدا، مقصد یا تاریخ دیگری را امتحان کنید.
</p>
</div>
@endforelse
</div>
</div>
</div>
@endsection
+72
View File
@@ -0,0 +1,72 @@
<section class="flight-detail-page">
<div class="container">
<div class="flight-detail-card">
<div class="flight-detail-image">
<img src="{{ asset($flight->image) }}"
alt="{{ $flight->airline }}">
</div>
<div class="flight-detail-content">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1>{{ $flight->airline }}</h1>
<span class="flight-badge-show">
پرواز
</span>
</div>
<div class="route-box">
<div>
<small>مبدا</small>
<strong>{{ $flight->origin }}</strong>
</div>
<div class="route-line">
✈
</div>
<div>
<small>مقصد</small>
<strong>{{ $flight->destination }}</strong>
</div>
</div>
<div class="flight-info-grid">
<div>
<span>کلاس پرواز</span>
<b>{{ $flight->flight_class }}</b>
</div>
<div>
<span>ظرفیت</span>
<b>{{ $flight->capacity }} نفر</b>
</div>
<div>
<span>تاریخ حرکت</span>
<b>{{ $flight->departure_date }}</b>
</div>
<div>
<span>قیمت</span>
<b>{{ number_format($flight->price) }} تومان</b>
</div>
</div>
</div>
</div>
</div>
</section>
+30 -2
View File
@@ -1,8 +1,36 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
<section class="container mt-5">
<h3 class="fw-bold mb-4">آخرین پروازها و تورها</h3>
@include('components.flight') <div class="swiper LatestProducts w-100">
@include('components.tour') <div class="swiper-wrapper py-3">
@forelse($newestFlight as $flight)
@include('components.flight')
@empty
<p class="text-secondary">هنوز پروازی ثبت نشده است.</p>
@endforelse
</div>
</div>
</section>
<section class="container my-5">
<h3 class="fw-bold mb-4">همه پروازها و تورها</h3>
<div class="row g-4">
@forelse($flights as $flight)
<div class="col-md-4">
@include('components.flight')
</div>
@empty
<p class="text-secondary">چیزی برای نمایش وجود ندارد.</p>
@endforelse
</div>
<div class="mt-4">
{{ $flights->links() }}
</div>
</section>
@endsection @endsection
+3 -2
View File
@@ -3,14 +3,15 @@
<!-- index.html 07:26:20 --> <!-- index.html 07:26:20 -->
<head> <head>
<title>airline_agency</title> <title>@yield('title', 'سامانه آژانس هواپیمایی')</title>
<meta charset="UTF-8"/> <meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="{{asset('assets/css/font-awesome.css')}}"/> <link rel="stylesheet" href="{{asset('assets/css/font-awesome.css')}}"/>
<link rel="stylesheet" href="{{asset('assets/css/lineicons.css')}}"/> <link rel="stylesheet" href="{{asset('assets/css/lineicons.css')}}"/>
<link rel="stylesheet" href="{{asset('assets/css/weather-icons.css')}}"/> <link rel="stylesheet" href="{{asset('assets/css/weather-icons.css')}}"/>
<link rel="stylesheet" href="{{asset('assets/css/bootstrap.css')}}"/> <link rel="stylesheet" href="{{asset('assets/css/bootstrap.css')}}"/>
<link rel="stylesheet" href="{{asset('assets/css/styles.css')}}"/> <link rel="stylesheet" href="{{ asset('assets/css/styles.css?v=2') }}">
<link rel="stylesheet" href="{{ asset('assets/css/styles2.css?v=2') }}">
</head> </head>
<body> <body>
+1 -1
View File
@@ -62,7 +62,7 @@
</div> </div>
<form action="{{ route('flights.search') }}" method="GET"> <form action="{{ route('users.favorite.index') }}" method="GET">
<div class="flight-fields"> <div class="flight-fields">
+74
View File
@@ -0,0 +1,74 @@
@foreach($tours as $tour)
<!-- TOUR ITEM -->
<div class="swiper-slide tour-card group">
<!-- tour image -->
<a href="#">
<img
class="tour-card_img"
src="{{ $tour->image ?? asset('assets/img/placeholder.jpg') }}"
alt="{{ $tour->title }}"
>
</a>
<!-- tour content -->
<div class="tour-card_content">
<!-- title -->
<a href="#" class="tour-card_title">
{{ $tour->title }}
</a>
<!-- destination -->
<div class="tour-card_destination">
<span>
📍
</span>
{{ $tour->destination }}
</div>
<!-- details -->
<div class="tour-card_details">
<div>
<span>مدت تور</span>
<strong>
{{ $tour->duration }} روز
</strong>
</div>
<div>
<span>ظرفیت</span>
<strong>
{{ $tour->capacity }} نفر
</strong>
</div>
</div>
<!-- price -->
<div class="tour-card_price">
<span>
شروع قیمت از
</span>
<strong>
{{ number_format($tour->price) }}
<small>تومان</small>
</strong>
</div>
</div>
</div>
@endforeach
+3
View File
@@ -0,0 +1,3 @@
<div>
<!-- Happiness is not something readymade. It comes from your own actions. - Dalai Lama -->
</div>
+8 -8
View File
@@ -7,17 +7,18 @@ use App\Http\Controllers\FavoriteController;
use App\Http\Controllers\FlightController; use App\Http\Controllers\FlightController;
use App\Http\Controllers\HomeController; use App\Http\Controllers\HomeController;
use App\Http\Controllers\ProfileController; use App\Http\Controllers\ProfileController;
use App\Http\Controllers\TourController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
Route::get('/', [HomeController::class,'index']) Route::get('/', [HomeController::class,'index'])->name('index');
->name('index');
Route::get('/flights/search', [FlightController::class, 'search']) Route::get('/flights', [FlightController::class, 'index'])->name('flights');
->name('flights.search'); Route::get('/flights/{flight}', [FlightController::class, 'show'])->name('flights.show');
Route::get('/tours', [TourController::class, 'index'])->name('tours.index');
Route::get('/tours/{tour}', [TourController::class, 'show'])->name('tours.show');
Route::get('/flights/archive', [FlightController::class, 'archive'])
->name('flights.archive');
Route::prefix('users')->name('users.')->middleware('auth:web')->group(function (){ Route::prefix('users')->name('users.')->middleware('auth:web')->group(function (){
Route::get('/',[DashboardController::class,'index'])->name('dashboard'); Route::get('/',[DashboardController::class,'index'])->name('dashboard');
@@ -33,7 +34,6 @@ Route::prefix('users')->name('users.')->middleware('auth:web')->group(function (
Route::get('/comments',[CommentController::class,'index'])->name('comments.index'); Route::get('/comments',[CommentController::class,'index'])->name('comments.index');
Route::get('/cities/{province}', [CityController::class, 'getCities']) Route::get('/cities/{province}', [CityController::class, 'byProvince'])->name('cities.province');
->name('cities.by.province');
}); });