Remove SimBrief with Bid (#1283)
* Update BidService.php * Update BidService.php Delete directly ;)
This commit is contained in:
parent
d64e674c21
commit
b0f52ed1d0
@ -8,6 +8,7 @@ use App\Exceptions\UserBidLimit;
|
||||
use App\Models\Bid;
|
||||
use App\Models\Flight;
|
||||
use App\Models\Pirep;
|
||||
use App\Models\SimBrief;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@ -164,6 +165,14 @@ class BidService extends Service
|
||||
$bid->forceDelete();
|
||||
}
|
||||
|
||||
// Remove SimBrief OFP when removing the bid if it is not flown
|
||||
if (setting('simbrief.only_bids')) {
|
||||
$simbrief = SimBrief::where([
|
||||
'user_id' => $user->id,
|
||||
'flight_id' => $flight->id,
|
||||
])->whereNull('pirep_id')->delete();
|
||||
}
|
||||
|
||||
// Only flip the flag if there are no bids left for this flight
|
||||
$bid_count = Bid::where(['flight_id' => $flight->id])->count();
|
||||
if ($bid_count === 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user