Remove invalid bids #1034

This commit is contained in:
Nabeel Shahzad 2021-02-17 18:03:07 -05:00
parent 942c060c99
commit 8907527872

View File

@ -147,6 +147,12 @@ class FlightController extends Controller
$flights = collect();
$saved_flights = [];
foreach ($user->bids as $bid) {
// Remove any invalid bids (flight doesn't exist or something)
if (!$bid->flight) {
$bid->delete();
continue;
}
$flights->add($bid->flight);
$saved_flights[] = $bid->flight->id;
}