git commit "Complete today's development"
This commit is contained in:
@@ -10,8 +10,12 @@ class CityController extends Controller
|
||||
//
|
||||
public function getCities($province)
|
||||
{
|
||||
return City::where('province_id', $province)
|
||||
|
||||
$cities = City::where('province_id',$province)
|
||||
->orderBy('name')
|
||||
->get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return response()->json($cities);
|
||||
|
||||
}}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\FlightSearchRequest;
|
||||
use App\Models\Flight;
|
||||
|
||||
class FlightController extends Controller
|
||||
{
|
||||
public function search(FlightSearchRequest $request)
|
||||
{
|
||||
$filters = $request->validated();
|
||||
|
||||
$flights = Flight::query()
|
||||
->applySearch($filters)
|
||||
->get();
|
||||
|
||||
return view('flights.search', compact('flights'));
|
||||
}
|
||||
|
||||
public function archive()
|
||||
{
|
||||
$flights = Flight::query()
|
||||
->latest()
|
||||
->paginate(12);
|
||||
|
||||
return view('flights.archive', compact('flights'));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,17 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Flight;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
//
|
||||
public function index()
|
||||
{
|
||||
return view('layouts.app');
|
||||
$latestFlights = Flight::query()
|
||||
->latest()
|
||||
->take(6)
|
||||
->get();
|
||||
|
||||
return view('home.index', compact('latestFlights'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user