diff --git a/app/Models/Flight.php b/app/Models/Flight.php index 29a7b1a4..00eb92a5 100644 --- a/app/Models/Flight.php +++ b/app/Models/Flight.php @@ -13,6 +13,7 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName; /** * @property string id + * @property mixed ident * @property Airline airline * @property integer airline_id * @property mixed flight_number diff --git a/app/Services/FlightService.php b/app/Services/FlightService.php index 247e394e..2dc213e3 100644 --- a/app/Services/FlightService.php +++ b/app/Services/FlightService.php @@ -209,7 +209,7 @@ class FlightService extends Service # bids $bids = Bid::where('user_id', $user->id)->get(); if ($bids->count() > 0 && setting('bids.allow_multiple_bids') === false) { - throw new BidExists('User "'.$user->id.'" already has bids, skipping'); + throw new BidExists('User "'.$user->ident.'" already has bids, skipping'); } # Get all of the bids for this flight @@ -229,6 +229,11 @@ class FlightService extends Service } } + # Check if the flight should be blocked off + if (setting('bids.disable_flight_on_bid') === true) { + throw new BidExists('Flight "'.$flight->ident.'" already has a bid, skipping'); + } + if (setting('bids.allow_multiple_bids') === false) { throw new BidExists('A bid already exists for this flight'); }