Fix AirportController (Frontend) (#1176)
1. Inbound and Outbound flights were displaying all flights (active and inactive) , fixed to fetch only active flights. 2. Flash message and redirect to Dashboard was not working, instead we were getting 404 Not Found error.
This commit is contained in:
@@ -36,8 +36,8 @@ class AirportController extends Controller
|
|||||||
{
|
{
|
||||||
$id = strtoupper($id);
|
$id = strtoupper($id);
|
||||||
|
|
||||||
$airport = $this->airportRepo->find($id);
|
$airport = $this->airportRepo->where('id', $id)->first();
|
||||||
if (empty($airport)) {
|
if (!$airport) {
|
||||||
Flash::error('Airport not found!');
|
Flash::error('Airport not found!');
|
||||||
return redirect(route('frontend.dashboard.index'));
|
return redirect(route('frontend.dashboard.index'));
|
||||||
}
|
}
|
||||||
@@ -46,12 +46,14 @@ class AirportController extends Controller
|
|||||||
->with(['dpt_airport', 'arr_airport', 'airline'])
|
->with(['dpt_airport', 'arr_airport', 'airline'])
|
||||||
->findWhere([
|
->findWhere([
|
||||||
'arr_airport_id' => $id,
|
'arr_airport_id' => $id,
|
||||||
|
'active' => 1,
|
||||||
])->all();
|
])->all();
|
||||||
|
|
||||||
$outbound_flights = $this->flightRepo
|
$outbound_flights = $this->flightRepo
|
||||||
->with(['dpt_airport', 'arr_airport', 'airline'])
|
->with(['dpt_airport', 'arr_airport', 'airline'])
|
||||||
->findWhere([
|
->findWhere([
|
||||||
'dpt_airport_id' => $id,
|
'dpt_airport_id' => $id,
|
||||||
|
'active' => 1,
|
||||||
])->all();
|
])->all();
|
||||||
|
|
||||||
return view('airports.show', [
|
return view('airports.show', [
|
||||||
|
|||||||
Reference in New Issue
Block a user