32 lines
782 B
PHP
32 lines
782 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Enums\Flight\FlightStatus;
|
|
use App\Enums\Tour\TourStatus;
|
|
use App\Models\Flight;
|
|
use App\Models\Tour;
|
|
use Illuminate\Http\Request;
|
|
|
|
class IndexController extends Controller
|
|
{
|
|
|
|
public function index()
|
|
{
|
|
$title = 'صفحه اصلی';
|
|
$flights = Flight::with('file')
|
|
->where('status', '=' , FlightStatus::AVAILABLE)
|
|
->orderByDesc('created_at')
|
|
->paginate(2, ['*'], 'flights_page');
|
|
|
|
$tours = Tour::with(['file' , 'originCity', 'city'])
|
|
->where('status', '=', TourStatus::AVAILABLE)
|
|
->orderByDesc('created_at')
|
|
->paginate(2, ['*'], 'tours_page');e(4);
|
|
|
|
|
|
|
|
return view('index' , compact('title' , 'flights' , 'tours'));
|
|
}
|
|
}
|