From 0a88bcb8b6eb35c172d8d84e8c077a8431eb3429 Mon Sep 17 00:00:00 2001 From: Andy Ford Date: Sat, 13 May 2023 16:29:48 +0100 Subject: [PATCH] fix: query escaping --- app/Allocator/Stand/AbstractArrivalStandAllocator.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Allocator/Stand/AbstractArrivalStandAllocator.php b/app/Allocator/Stand/AbstractArrivalStandAllocator.php index 71c3c0ac0..35efcb1e6 100644 --- a/app/Allocator/Stand/AbstractArrivalStandAllocator.php +++ b/app/Allocator/Stand/AbstractArrivalStandAllocator.php @@ -61,7 +61,16 @@ private function applyBaseOrderingToStandsQuery(Builder $query, NetworkAircraft // Prefer stands that haven't been requested by someone else $join->on('stands.id', '=', 'other_stand_requests.stand_id') ->on('other_stand_requests.user_id', '<>', $join->raw($aircraft->cid)) - ->on('other_stand_requests.requested_time', '>', $join->raw(Carbon::now())); + ->on( + 'other_stand_requests.requested_time', + '>', + $join->raw( + sprintf( + '\'%s\'', + Carbon::now() + ) + ) + ); }) ->orderByRaw('other_stand_requests.id IS NULL') ->inRandomOrder();