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;
use App\Models\City;
use Illuminate\Http\Request;
class CityController extends Controller
{
//
public function getCities($province)
public function byProvince(int $province)
{
$cities = City::where('province_id',$province)
$cities = City::where('provinces', $province)
->orderBy('name')
->get();
->get(['id', 'name']);
return response()->json($cities);
}}
}
}
+14 -14
View File
@@ -2,29 +2,29 @@
namespace App\Http\Controllers;
use App\Http\Requests\FlightSearchRequest;
use App\Models\Flight;
use Illuminate\Http\Request;
class FlightController extends Controller
{
public function search(FlightSearchRequest $request)
public function index()
{
$filters = $request->validated();
$flights = Flight::query()
->applySearch($filters)
$newestFlight = Flight::
latest()
->applySearch()
->take(10)
->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()
->latest()
->paginate(12);
return view('flights.archive', compact('flights'));
$flight->increment('views');
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\Tour;
use App\Models\Province;
class HomeController extends Controller
{
public function index()
{
$flights = Flight::latest('created_at')
->take(6)
->get();
$newestFlight = Flight::latest()->take(10)->get();
$flights=Flight::latest()->paginate(5);
$newestTour = Tour::latest()->take(10)->get();
$tours = Tour::latest('created_at')
->take(6)
->get();
return view('home.index', compact('flights', 'tours'));
return view('home.index', compact('newestFlight','flights', 'newestTour'));
}
}
+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' => [
'required',
'unique:users,national_code',
'ir_national_id'
],
],
'gender' => [
'required',
+4
View File
@@ -25,6 +25,8 @@ use Illuminate\Database\Eloquent\Model;
* @property string|null $flight_class
* @property int|null $capacity
* @property float|null $price
* @property string|null $image
* @property string|null $views
* @property int|null $status
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
@@ -56,6 +58,8 @@ class Flight extends Model
'flight_class',
'capacity',
'price',
'image',
'views',
'status'
];