git commit "update flight page"
This commit is contained in:
@@ -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);
|
||||
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
}
|
||||
@@ -41,8 +41,7 @@ class RegisterPostRequest extends FormRequest
|
||||
'national_code' => [
|
||||
'required',
|
||||
'unique:users,national_code',
|
||||
'ir_national_id'
|
||||
],
|
||||
],
|
||||
|
||||
'gender' => [
|
||||
'required',
|
||||
|
||||
Reference in New Issue
Block a user