git commit "update flight page"
This commit is contained in:
@@ -2,29 +2,29 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\FlightSearchRequest;
|
||||
use App\Models\Flight;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FlightController extends Controller
|
||||
{
|
||||
public function search(FlightSearchRequest $request)
|
||||
public function index()
|
||||
{
|
||||
$filters = $request->validated();
|
||||
|
||||
$flights = Flight::query()
|
||||
->applySearch($filters)
|
||||
$newestFlight = Flight::
|
||||
latest()
|
||||
->applySearch()
|
||||
->take(10)
|
||||
->get();
|
||||
$flights = Flight::latest()->
|
||||
paginate(9);
|
||||
|
||||
return view('flights.search', compact('flights'));
|
||||
return view('home.index', compact('newestFlight', 'flights'));
|
||||
}
|
||||
|
||||
public function archive()
|
||||
public function show(Flight $flight)
|
||||
{
|
||||
$flights = Flight::query()
|
||||
->latest()
|
||||
->paginate(12);
|
||||
|
||||
return view('flights.archive', compact('flights'));
|
||||
$flight->increment('views');
|
||||
|
||||
return view('flights.show', compact('flight'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user