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:
B.Fatih KOZ
2021-05-08 22:42:18 +03:00
committed by GitHub
parent 6e6ba85080
commit a186bfae2a

View File

@@ -36,8 +36,8 @@ class AirportController extends Controller
{
$id = strtoupper($id);
$airport = $this->airportRepo->find($id);
if (empty($airport)) {
$airport = $this->airportRepo->where('id', $id)->first();
if (!$airport) {
Flash::error('Airport not found!');
return redirect(route('frontend.dashboard.index'));
}
@@ -46,12 +46,14 @@ class AirportController extends Controller
->with(['dpt_airport', 'arr_airport', 'airline'])
->findWhere([
'arr_airport_id' => $id,
'active' => 1,
])->all();
$outbound_flights = $this->flightRepo
->with(['dpt_airport', 'arr_airport', 'airline'])
->findWhere([
'dpt_airport_id' => $id,
'active' => 1,
])->all();
return view('airports.show', [