git add .
git commit "add tours pages, components and show views"
This commit is contained in:
@@ -10,10 +10,26 @@ class HomeController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$newestFlight = Flight::latest()->take(10)->get();
|
||||
$flights=Flight::latest()->paginate(5);
|
||||
$newestTour = Tour::latest()->take(10)->get();
|
||||
$newestFlight = Flight::
|
||||
where('departure_date', '>=', now())
|
||||
->orderBy('departure_date', 'asc')
|
||||
->take(3)
|
||||
->get();
|
||||
$newestTour = Tour::latest()
|
||||
->take(10)
|
||||
->get();
|
||||
|
||||
return view('home.index', compact('newestFlight','flights', 'newestTour'));
|
||||
$flights = Flight::latest()
|
||||
->paginate(5);
|
||||
|
||||
$tours = Tour::latest()
|
||||
->paginate(5);
|
||||
|
||||
return view('home.index', compact(
|
||||
'newestFlight',
|
||||
'newestTour',
|
||||
'flights',
|
||||
'tours'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,19 +6,24 @@ use App\Models\Tour;
|
||||
|
||||
class TourController extends Controller
|
||||
{
|
||||
// صفحه لیست تورها: اسلایدر آخرینها + گرید صفحهبندیشده
|
||||
public function index()
|
||||
{
|
||||
$newestTour = Tour::latest()->take(10)->get();
|
||||
$tours = Tour::latest()->paginate(9);
|
||||
$newestTour = Tour::with('travelType')
|
||||
->latest()
|
||||
->take(10)
|
||||
->get();
|
||||
|
||||
$tours = Tour::with('travelType')
|
||||
->latest()
|
||||
->paginate(5);
|
||||
|
||||
return view('tours.index', compact('newestTour', 'tours'));
|
||||
}
|
||||
|
||||
// جزئیات تور + شمارنده بازدید
|
||||
|
||||
public function show(Tour $tour)
|
||||
{
|
||||
$tour->increment('views');
|
||||
$tour->load('travelType');
|
||||
|
||||
return view('tours.show', compact('tour'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user