Skip to content

Commit

Permalink
refactor: fix phpstan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
daveroverts committed Mar 14, 2024
1 parent 6fb0360 commit 20c13a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions app/Http/Controllers/Booking/BookingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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'),
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/EventCleanupReservationsJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 20c13a1

Please sign in to comment.