diff --git a/app/Services/FlightService.php b/app/Services/FlightService.php index cdf24ae5..3a65d3b2 100644 --- a/app/Services/FlightService.php +++ b/app/Services/FlightService.php @@ -20,9 +20,9 @@ class FlightService extends BaseService * Allow a user to bid on a flight. Check settings and all that good stuff * @param Flight $flight * @param User $user - * @return UserBid + * @return UserBid|null */ - public function addBid(Flight $flight, User $user): UserBid + public function addBid(Flight $flight, User $user) { # If it's already been bid on, then it can't be bid on again if($flight->has_bid && setting('bids.disable_flight_on_bid')) { @@ -74,7 +74,10 @@ class FlightService extends BaseService $user_bid->forceDelete(); } - $flight->has_bid = false; - $flight->save(); + # Only flip the flag if there are no bids left for this flight + if(!UserBid::where('flight_id', $flight->id)->exists()) { + $flight->has_bid = false; + $flight->save(); + } } } diff --git a/phpvms.iml b/phpvms.iml index 34e6cb40..8b7db6af 100644 --- a/phpvms.iml +++ b/phpvms.iml @@ -306,19 +306,6 @@ - - - - - - - - - - - - -