git commit "fix user panel pages hero layout and add profile dropdown improvements"
This commit is contained in:
@@ -3,33 +3,49 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Flight;
|
||||
use App\Models\Tour;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FlightController extends Controller
|
||||
{
|
||||
public function index()
|
||||
public function index(Request $request)
|
||||
{
|
||||
$newestFlight = Flight::
|
||||
latest()
|
||||
->applySearch()
|
||||
->take(10)
|
||||
$flights = Flight::latest()
|
||||
->applySearch($request->all())
|
||||
->paginate(10);
|
||||
|
||||
|
||||
$newestFlight = Flight::latest()
|
||||
->take(3)
|
||||
->get();
|
||||
$flights = Flight::latest()->
|
||||
paginate(9);
|
||||
|
||||
return view('home.index', compact('newestFlight', 'flights'));
|
||||
|
||||
$newestTour = Tour::latest()
|
||||
->take(3)
|
||||
->get();
|
||||
|
||||
|
||||
$tours = Tour::latest()
|
||||
->paginate(10);
|
||||
|
||||
|
||||
return view('flights.index', compact(
|
||||
'flights',
|
||||
'newestFlight',
|
||||
'newestTour',
|
||||
'tours'
|
||||
));
|
||||
}
|
||||
|
||||
public function show(Flight $flight)
|
||||
public function show(Flight $flight)
|
||||
{
|
||||
$flight->increment('views');
|
||||
|
||||
$comments = $flight->comments()
|
||||
->latest()
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
|
||||
return view('flights.show', compact('flight','comments'));
|
||||
return view('flights.show', compact('flight', 'comments'));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user