970786ae94
git commit "add tours pages, components and show views"
36 lines
720 B
PHP
36 lines
720 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Flight;
|
|
use App\Models\Tour;
|
|
use App\Models\Province;
|
|
|
|
class HomeController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$newestFlight = Flight::
|
|
where('departure_date', '>=', now())
|
|
->orderBy('departure_date', 'asc')
|
|
->take(3)
|
|
->get();
|
|
$newestTour = Tour::latest()
|
|
->take(10)
|
|
->get();
|
|
|
|
$flights = Flight::latest()
|
|
->paginate(5);
|
|
|
|
$tours = Tour::latest()
|
|
->paginate(5);
|
|
|
|
return view('home.index', compact(
|
|
'newestFlight',
|
|
'newestTour',
|
|
'flights',
|
|
'tours'
|
|
));
|
|
}
|
|
}
|