From 20c13a1b38dc350f9126cbc91bfc7738eb428abc Mon Sep 17 00:00:00 2001 From: Dave Roverts Date: Thu, 14 Mar 2024 19:05:33 +0100 Subject: [PATCH] refactor: fix phpstan issues --- app/Http/Controllers/Booking/BookingController.php | 8 ++++---- app/Jobs/EventCleanupReservationsJob.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Booking/BookingController.php b/app/Http/Controllers/Booking/BookingController.php index 2d00aa97..10d21c0d 100644 --- a/app/Http/Controllers/Booking/BookingController.php +++ b/app/Http/Controllers/Booking/BookingController.php @@ -38,7 +38,7 @@ public function edit(Booking $booking): View|RedirectResponse if ($booking->status != BookingStatus::UNASSIGNED) { // Check if current user has booked/reserved if ($booking->user_id == auth()->id()) { - if ($booking->status == BookingStatus::BOOKED->value && !$booking->is_editable) { + if ($booking->status == BookingStatus::BOOKED && !$booking->is_editable) { flashMessage('info', __('Danger'), __('You cannot edit the booking!')); return to_route('bookings.event.index', $booking->event); } @@ -49,7 +49,7 @@ public function edit(Booking $booking): View|RedirectResponse return view('booking.edit', compact('booking', 'flight')); } else { // Check if the booking has already been reserved - if ($booking->status === BookingStatus::RESERVED->value) { + if ($booking->status == BookingStatus::RESERVED) { flashMessage( 'danger', __('Warning'), @@ -96,7 +96,7 @@ public function edit(Booking $booking): View|RedirectResponse ->by(auth()->user()) ->on($booking) ->log('Flight reserved'); - $booking->status = BookingStatus::RESERVED->value; + $booking->status = BookingStatus::RESERVED; $booking->user()->associate(auth()->user())->save(); flashMessage( 'info', @@ -228,7 +228,7 @@ public function cancel(Booking $booking): RedirectResponse $message = __('Slot is now free to use again'); } - $booking->status = BookingStatus::UNASSIGNED->value; + $booking->status = BookingStatus::UNASSIGNED; flashMessage('info', $title, $message); $booking->user()->dissociate()->save(); return to_route('bookings.event.index', $booking->event); diff --git a/app/Jobs/EventCleanupReservationsJob.php b/app/Jobs/EventCleanupReservationsJob.php index 219c7ac7..c3eedd14 100644 --- a/app/Jobs/EventCleanupReservationsJob.php +++ b/app/Jobs/EventCleanupReservationsJob.php @@ -39,7 +39,7 @@ public function handle(): void ->whereStatus(BookingStatus::RESERVED->value) ->each(function (Booking $booking) { if (now()->greaterThanOrEqualTo($booking->updated_at->addMinutes(10))) { - $booking->status = BookingStatus::UNASSIGNED->value; + $booking->status = BookingStatus::UNASSIGNED; $booking->user_id = null; $booking->save(); }