git add .

git commit  "add tours pages, components and show views"
This commit is contained in:
2026-08-17 11:36:19 +03:30
parent e99c340f1e
commit 970786ae94
15 changed files with 595 additions and 249 deletions
+20 -4
View File
@@ -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'
));
}
}
+10 -5
View File
@@ -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'));
}