view flight bids in flights screen #203

This commit is contained in:
Nabeel Shahzad
2018-03-20 11:28:06 -05:00
parent 06e1cd15c0
commit 4e59bd0442
9 changed files with 69 additions and 25 deletions

View File

@@ -37,8 +37,7 @@ class FlightController extends Controller
AirportRepository $airportRepo,
FlightRepository $flightRepo,
GeoService $geoSvc
)
{
) {
$this->airlineRepo = $airlineRepo;
$this->airportRepo = $airportRepo;
$this->flightRepo = $flightRepo;
@@ -51,7 +50,9 @@ class FlightController extends Controller
*/
public function index(Request $request)
{
$where = ['active' => true];
$where = [
'active' => true
];
// default restrictions on the flights shown. Handle search differently
if (setting('pilots.only_flights_from_current')) {
@@ -77,6 +78,27 @@ class FlightController extends Controller
]);
}
/**
* Find the user's bids and display them
* @param Request $request
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function bids(Request $request)
{
$user = Auth::user();
$flights = $user->flights()->paginate();
$saved_flights = $flights->pluck('id')->toArray();
return view('flights.index', [
'title' => 'Bids',
'airlines' => $this->airlineRepo->selectBoxList(true),
'airports' => $this->airportRepo->selectBoxList(true),
'flights' => $flights,
'saved' => $saved_flights,
]);
}
/**
* Make a search request using the Repository search
* @param Request $request