Remove invalid bids #1034
This commit is contained in:
parent
942c060c99
commit
8907527872
@ -147,6 +147,12 @@ class FlightController extends Controller
|
|||||||
$flights = collect();
|
$flights = collect();
|
||||||
$saved_flights = [];
|
$saved_flights = [];
|
||||||
foreach ($user->bids as $bid) {
|
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);
|
$flights->add($bid->flight);
|
||||||
$saved_flights[] = $bid->flight->id;
|
$saved_flights[] = $bid->flight->id;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user