33 lines
760 B
PHP
33 lines
760 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Flight;
|
|
use App\Models\Tour;
|
|
|
|
class IndexController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
|
|
$tours = Tour::query()
|
|
->where('status', 1)
|
|
->orderByDesc('created_at')
|
|
->paginate(6, ['*'], 'tours_page');
|
|
|
|
$flights = Flight::query()
|
|
->where('status', 1)
|
|
->orderByDesc('created_at')
|
|
->paginate(6, ['*'], 'flights_page');
|
|
|
|
$latestTours= Tour::latest()->limit(6)->get();
|
|
$latestFlights = Flight::latest()->limit(6)->get();
|
|
|
|
return view('index', [
|
|
'tours' => $tours,
|
|
'flights' => $flights,
|
|
compact('latestTours', 'latestFlights')
|
|
]);
|
|
}
|
|
}
|