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 Jun 6, 2024
1 parent 0dbba90 commit 92ab5ac
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 11 deletions.
4 changes: 3 additions & 1 deletion app/Http/Controllers/Faq/FaqAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public function index(): View
public function create(): View
{
$faq = new Faq();
return view('faq.admin.form', compact('faq'));

$events = collect();
return view('faq.admin.form', compact('faq', 'events'));
}

public function store(StoreFaq $request): RedirectResponse
Expand Down
12 changes: 10 additions & 2 deletions app/Http/Livewire/Bookings.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,18 @@ public function render()
abort_unless(auth()->check() && auth()->user()->isAdmin, 404);
}

$this->booked = $this->bookings->where('status', BookingStatus::BOOKED->value)->count();
$this->booked = $this->bookings->where('status', BookingStatus::BOOKED)->count();

$this->total = $this->bookings->count();

return view('livewire.bookings');
// https://github.com/TomasVotruba/bladestan/issues/65#issuecomment-1582383622
return view('livewire.bookings', [
'event' => $this->event,
'refreshInSeconds' => $this->refreshInSeconds,
'bookings' => $this->bookings,
'filter' => $this->filter,
'total' => $this->total,
'booked' => $this->booked,
]);
}
}
3 changes: 2 additions & 1 deletion resources/views/booking/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@

<x-form-group inline>
<x-form-submit>
<i class="fas fa-check"></i> {{ $booking->bookedBy ? 'Edit' : 'Confirm' }} Booking
<i class="fas fa-check"></i>
{{ $booking->status === \App\Enums\BookingStatus::RESERVED ? 'Confirm' : 'Edit' }} Booking
</x-form-submit>

@if ($booking->status === \App\Enums\BookingStatus::RESERVED)
Expand Down
3 changes: 2 additions & 1 deletion resources/views/booking/edit_multiflights.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@

<x-form-group inline>
<x-form-submit>
<i class="fas fa-check"></i> {{ $booking->bookedBy ? 'Edit' : 'Confirm' }} Booking
<i class="fas fa-check"></i>
{{ $booking->status === \App\Enums\BookingStatus::RESERVED ? 'Confirm' : 'Edit' }} Booking
</x-form-submit>

@if ($booking->status === \App\Enums\BookingStatus::RESERVED)
Expand Down
3 changes: 1 addition & 2 deletions resources/views/booking/overview/default.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@
{{-- Check if user already has a booking --}}
@if (
$booking->event->multiple_bookings_allowed ||
(!$booking->event->multiple_bookings_allowed &&
!auth()->user()->bookings->where('event_id', $event->id)->first()))
auth()->user()->bookings->where('event_id', $booking->event->id)->isEmpty())
{{-- Check if user already has a booking, and only 1 is allowed --}}
<a href="{{ route('bookings.edit', $booking) }}" class="btn btn-success">BOOK
NOW</a>
Expand Down
3 changes: 1 addition & 2 deletions resources/views/booking/overview/multiflights.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@
{{-- Check if user already has a booking --}}
@if (
$booking->event->multiple_bookings_allowed ||
(!$booking->event->multiple_bookings_allowed &&
!auth()->user()->bookings->where('event_id', $event->id)->first()))
auth()->user()->bookings->where('event_id', $booking->event->id)->isEmpty())
{{-- Check if user already has a booking, and only 1 is allowed --}}
<a href="{{ route('bookings.edit', $booking) }}" class="btn btn-success">BOOK
NOW</a>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/livewire/bookings.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class="fa fa-plus"></i>
</p>
@include('layouts.alert')
@if($event->startBooking <= now() || auth()->check() && auth()->user()->isAdmin)
Flights available: {{ $total - $booked }} / {{ $total }}
Flights available: {{ strval($total - $booked) }} / {{ $total }}
<table class="table table-hover table-responsive">
@if($event->event_type_id == \App\Enums\EventType::MULTIFLIGHTS)
@if($event->event_type_id == \App\Enums\EventType::MULTIFLIGHTS->value)
@include('booking.overview.multiflights')
@else
@include('booking.overview.default')
Expand Down

0 comments on commit 92ab5ac

Please sign in to comment.