From 4ee1aa457aa67be6ac99af40bb4c48d1a7f67f3e Mon Sep 17 00:00:00 2001 From: Dave Roverts Date: Wed, 26 Feb 2025 20:33:06 +0100 Subject: [PATCH] chore: run rector --- .../EventCleanupReservationsCommand.php | 2 +- app/Exceptions/Handler.php | 2 +- .../AirportLinkAdminController.php | 5 +- app/Http/Controllers/Auth/LoginController.php | 2 +- .../Booking/BookingAdminController.php | 14 ++-- .../Controllers/Booking/BookingController.php | 16 ++--- .../Event/EventAdminController.php | 12 ++-- .../EventLink/EventLinkAdminController.php | 5 +- app/Http/Controllers/OAuthController.php | 2 +- app/Http/View/Composers/EventsComposer.php | 12 ++-- app/Jobs/EventCleanupReservationsJob.php | 2 +- app/Jobs/ImportAirportsJob.php | 2 +- app/Livewire/Bookings.php | 19 ++---- app/Models/Airport.php | 6 +- app/Models/AirportLinkType.php | 2 +- app/Models/Booking.php | 10 +-- app/Models/EventType.php | 2 +- app/Models/Flight.php | 4 +- app/Notifications/BookingCancelled.php | 9 +-- app/Notifications/BookingChanged.php | 9 +-- app/Notifications/BookingConfirmed.php | 9 +-- app/Notifications/BookingDeleted.php | 9 +-- app/Notifications/EventBulkEmail.php | 9 +-- app/Notifications/EventFinalInformation.php | 9 +-- app/Providers/EventServiceProvider.php | 24 +++---- app/Providers/HorizonServiceProvider.php | 4 +- app/Providers/RouteServiceProvider.php | 6 +- app/Providers/TelescopeServiceProvider.php | 4 +- app/Providers/ViewServiceProvider.php | 2 +- config/ide-helper.php | 4 +- config/oauth.php | 4 +- database/factories/BookingFactory.php | 24 +++---- database/factories/EventFactory.php | 30 ++++----- database/factories/FaqFactory.php | 8 +-- database/factories/UserFactory.php | 40 +++++------ .../2014_10_12_000000_create_users_table.php | 2 +- ...018_06_06_172719_create_airports_table.php | 2 +- .../2018_06_06_174837_create_events_table.php | 2 +- ...018_06_06_182242_create_bookings_table.php | 2 +- ...042_add_foreign_keys_to_bookings_table.php | 4 +- .../2018_06_16_205218_create_jobs_table.php | 2 +- ..._06_17_114535_create_failed_jobs_table.php | 2 +- ..._140133_set_form_sent_default_to_false.php | 4 +- ...7_30_170822_add_uuid_to_bookings_table.php | 4 +- ...12_155540_add_status_to_bookings_table.php | 4 +- ...065730_create_airport_link_types_table.php | 2 +- ...9_13_065748_create_airport_links_table.php | 6 +- ..._09_16_141549_create_event_types_table.php | 2 +- ..._141648_add_event_type_to_events_table.php | 6 +- ...16_204959_add_airports_to_events_table.php | 6 +- ...3421_remove_feedback_from_events_table.php | 4 +- ...14_add_event_variables_to_events_table.php | 4 +- ...8_184552_add_image_url_to_events_table.php | 4 +- ...ake_division_nullable_from_users_table.php | 4 +- ...191327_add_airport_view_to_users_table.php | 4 +- ...3038_add_monospace_font_to_users_table.php | 4 +- ...2_10_214244_create_notifications_table.php | 2 +- ...12_16_154113_create_activity_log_table.php | 2 +- .../2019_02_13_204936_create_faqs_table.php | 2 +- ...19_02_13_210046_create_event_faq_table.php | 2 +- ...09_173511_add_isonline_to_events_table.php | 4 +- ...90129_add_iseditable_to_bookings_table.php | 4 +- ...2_add_show_on_homepage_to_events_table.php | 4 +- ...2019_12_28_095749_create_flights_table.php | 2 +- ...1_15_182004_add_notes_to_flights_table.php | 4 +- ...mation_email_sent_at_to_bookings_table.php | 4 +- ...216_add_connect_columns_to_users_table.php | 4 +- ...47_remove_subdivision_from_users_table.php | 4 +- ...secret_nullable_in_oauth_clients_table.php | 4 +- ...2020_08_07_184418_change_route_to_text.php | 4 +- ...5_141406_add_uuid_to_failed_jobs_table.php | 4 +- ...oceanic_track_to_text_in_flights_table.php | 4 +- ..._01_28_185449_create_event_links_table.php | 4 +- ...add_event_column_to_activity_log_table.php | 4 +- ...atch_uuid_column_to_activity_log_table.php | 4 +- ..._02_125521_add_coordinates_in_airports.php | 4 +- .../vendor/notifications/email.blade.php | 12 ++-- routes/api.php | 48 +++++--------- routes/breadcrumbs.php | 66 +++++++++---------- routes/channels.php | 4 +- routes/console.php | 2 +- routes/web.php | 6 +- .../Commands/ImportAirportsCommandTest.php | 2 +- .../Http/Controllers/EventControllerTest.php | 2 +- .../Http/Controllers/FaqControllerTest.php | 6 +- .../Http/Controllers/HomeControllerTest.php | 4 +- .../Jobs/EventCleanupReservationsJobTest.php | 2 +- tests/Feature/Views/Layout/NavbarTest.php | 8 +-- tests/Pest.php | 4 +- tests/Unit/AirportLinkTest.php | 2 +- tests/Unit/AirportTest.php | 2 +- tests/Unit/BookingTest.php | 2 +- tests/Unit/EventLinkTest.php | 2 +- tests/Unit/EventTest.php | 2 +- tests/Unit/FaqTest.php | 4 +- 95 files changed, 282 insertions(+), 365 deletions(-) diff --git a/app/Console/Commands/EventCleanupReservationsCommand.php b/app/Console/Commands/EventCleanupReservationsCommand.php index de690c62..510fa7fb 100644 --- a/app/Console/Commands/EventCleanupReservationsCommand.php +++ b/app/Console/Commands/EventCleanupReservationsCommand.php @@ -48,7 +48,7 @@ public function handle() } EventCleanupReservationsJob::dispatch($event); } else { - $this->withProgressBar(nextEvents(), function ($event) { + $this->withProgressBar(nextEvents(), function ($event): void { EventCleanupReservationsJob::dispatch($event); }); } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index d92e585d..97b78c2a 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -34,7 +34,7 @@ class Handler extends ExceptionHandler */ public function register(): void { - $this->reportable(function (Throwable $e) { + $this->reportable(function (Throwable $e): void { // }); } diff --git a/app/Http/Controllers/AirportLink/AirportLinkAdminController.php b/app/Http/Controllers/AirportLink/AirportLinkAdminController.php index 3396165a..48285999 100644 --- a/app/Http/Controllers/AirportLink/AirportLinkAdminController.php +++ b/app/Http/Controllers/AirportLink/AirportLinkAdminController.php @@ -32,10 +32,9 @@ public function create(): View $airportLink = new AirportLink(); $airportLinkTypes = AirportLinkType::pluck('name', 'id'); $airports = Airport::all(['id', 'icao', 'iata', 'name'])->keyBy('id') - ->map(function ($airport) { + ->map(fn ($airport) => /** @var Airport $airport */ - return "$airport->icao | $airport->name | $airport->iata"; - }); + "$airport->icao | $airport->name | $airport->iata"); return view('airportLink.admin.form', compact('airportLink', 'airportLinkTypes', 'airports')); } diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 44e4dc8f..70dbf7dd 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -70,7 +70,7 @@ protected function verifyLogin(Request $request) $accessToken = $this->provider->getAccessToken('authorization_code', [ 'code' => $request->input('code') ]); - } catch (IdentityProviderException $e) { + } catch (IdentityProviderException) { flashMessage('error', 'Login failed', 'Something went wrong, please try again'); return to_route('home'); } diff --git a/app/Http/Controllers/Booking/BookingAdminController.php b/app/Http/Controllers/Booking/BookingAdminController.php index 5a8924de..153bee82 100644 --- a/app/Http/Controllers/Booking/BookingAdminController.php +++ b/app/Http/Controllers/Booking/BookingAdminController.php @@ -37,10 +37,9 @@ public function create(Event $event, Request $request): View { $bulk = $request->bulk; $airports = Airport::all(['id', 'icao', 'iata', 'name'])->keyBy('id') - ->map(function ($airport) { + ->map(fn ($airport) => /** @var Airport $airport */ - return "$airport->icao | $airport->name | $airport->iata"; - }); + "$airport->icao | $airport->name | $airport->iata"); return view('booking.admin.create', compact('event', 'airports', 'bulk')); } @@ -63,7 +62,7 @@ public function store(StoreBooking $request): RedirectResponse } $time->second = 0; - if (!Flight::whereHas('booking', function ($query) use ($request) { + if (!Flight::whereHas('booking', function ($query) use ($request): void { $query->where('event_id', $request->id); })->where([ 'ctot' => $time, @@ -123,10 +122,9 @@ public function edit(Booking $booking): View|RedirectResponse { if ($booking->event->endEvent >= now()) { $airports = Airport::all(['id', 'icao', 'iata', 'name'])->keyBy('id') - ->map(function ($airport) { + ->map(fn ($airport) => /** @var Airport $airport */ - return "$airport->icao | $airport->name | $airport->iata"; - }); + "$airport->icao | $airport->name | $airport->iata"); $flight = $booking->flights()->first(); return view('booking.admin.edit', compact('booking', 'airports', 'flight')); } @@ -258,7 +256,7 @@ public function adminAutoAssign(AutoAssign $request, Event $event): RedirectResp { // @TODO Optimise this, for now it's a ugly fix $bookings = $event->bookings() - ->with(['flights' => function ($query) { + ->with(['flights' => function ($query): void { $query->orderBy('ctot'); }]); diff --git a/app/Http/Controllers/Booking/BookingController.php b/app/Http/Controllers/Booking/BookingController.php index 10d21c0d..dfef78c3 100644 --- a/app/Http/Controllers/Booking/BookingController.php +++ b/app/Http/Controllers/Booking/BookingController.php @@ -174,21 +174,21 @@ public function update(UpdateBooking $request, Booking $booking): RedirectRespon public function validateSELCAL($selcal, $eventId): ?string { // Separate characters - $char1 = substr($selcal, 0, 1); - $char2 = substr($selcal, 1, 1); - $char3 = substr($selcal, 3, 1); - $char4 = substr($selcal, 4, 1); + $char1 = substr((string) $selcal, 0, 1); + $char2 = substr((string) $selcal, 1, 1); + $char3 = substr((string) $selcal, 3, 1); + $char4 = substr((string) $selcal, 4, 1); // Check if SELCAL has valid format - if (!preg_match("/[ABCDEFGHJKLMPQRS]{2}[-][ABCDEFGHJKLMPQRS]{2}/", $selcal)) { + if (!preg_match("/[ABCDEFGHJKLMPQRS]{2}[-][ABCDEFGHJKLMPQRS]{2}/", (string) $selcal)) { return null; } // Check if each character is unique - if (substr_count($selcal, $char1) > 1 || substr_count($selcal, $char2) > 1 || substr_count( - $selcal, + if (substr_count((string) $selcal, $char1) > 1 || substr_count((string) $selcal, $char2) > 1 || substr_count( + (string) $selcal, $char3 - ) > 1 || substr_count($selcal, $char4) > 1) { + ) > 1 || substr_count((string) $selcal, $char4) > 1) { return null; } diff --git a/app/Http/Controllers/Event/EventAdminController.php b/app/Http/Controllers/Event/EventAdminController.php index 5adafd2e..a5bed0fe 100644 --- a/app/Http/Controllers/Event/EventAdminController.php +++ b/app/Http/Controllers/Event/EventAdminController.php @@ -39,10 +39,9 @@ public function create(): View { $event = new Event(); $airports = Airport::all(['id', 'icao', 'iata', 'name'])->keyBy('id') - ->map(function ($airport) { + ->map(fn ($airport) => /** @var Airport $airport */ - return "$airport->icao | $airport->name | $airport->iata"; - }); + "$airport->icao | $airport->name | $airport->iata"); $eventTypes = EventType::pluck('name', 'id'); return view('event.admin.form', compact('event', 'airports', 'eventTypes')); } @@ -83,10 +82,9 @@ public function show(Event $event): View public function edit(Event $event): View { $airports = Airport::all(['id', 'icao', 'iata', 'name'])->keyBy('id') - ->map(function ($airport) { + ->map(fn ($airport) => /** @var Airport $airport */ - return "$airport->icao | $airport->name | $airport->iata"; - }); + "$airport->icao | $airport->name | $airport->iata"); $eventTypes = EventType::pluck('name', 'id'); return view('event.admin.form', compact('event', 'airports', 'eventTypes')); } @@ -141,7 +139,7 @@ public function sendEmail(SendEmail $request, Event $event): JsonResponse|Redire return response()->json(['success' => __('Email has been sent to yourself')]); } else { /* @var User $users */ - $users = User::whereHas('bookings', function (Builder $query) use ($event) { + $users = User::whereHas('bookings', function (Builder $query) use ($event): void { $query->where('event_id', $event->id); $query->where('status', BookingStatus::BOOKED->value); })->get(); diff --git a/app/Http/Controllers/EventLink/EventLinkAdminController.php b/app/Http/Controllers/EventLink/EventLinkAdminController.php index dd78f7c3..597c690a 100644 --- a/app/Http/Controllers/EventLink/EventLinkAdminController.php +++ b/app/Http/Controllers/EventLink/EventLinkAdminController.php @@ -35,10 +35,9 @@ public function create(): View ->orderBy('startEvent') ->get(['id', 'name', 'startEvent']) ->keyBy('id') - ->map(function ($event) { + ->map(fn ($event) => /** @var Event $event */ - return "$event->name [{$event->startEvent->format('d-m-Y')}]"; - }); + "$event->name [{$event->startEvent->format('d-m-Y')}]"); return view('eventLink.admin.form', compact('eventLink', 'eventLinkTypes', 'events')); } diff --git a/app/Http/Controllers/OAuthController.php b/app/Http/Controllers/OAuthController.php index 952aa2ef..58d6020a 100644 --- a/app/Http/Controllers/OAuthController.php +++ b/app/Http/Controllers/OAuthController.php @@ -37,7 +37,7 @@ public static function updateToken($token): ?AccessToken return $controller->getAccessToken('refresh_token', [ 'refresh_token' => $token->getRefreshToken() ]); - } catch (IdentityProviderException $e) { + } catch (IdentityProviderException) { return null; } } diff --git a/app/Http/View/Composers/EventsComposer.php b/app/Http/View/Composers/EventsComposer.php index 01c4c1c1..3107d04c 100644 --- a/app/Http/View/Composers/EventsComposer.php +++ b/app/Http/View/Composers/EventsComposer.php @@ -16,15 +16,13 @@ public function __construct() $this->events = Event::where('endEvent', '>', now()) ->orderBy('startEvent') ->where('is_online', true) - ->where(function ($query) { + ->where(function ($query): void { /** @var Builder $query */ $query->where('show_on_homepage', true) - ->when(auth()->id(), function ($query, $userId) { - return $query->orWhereHas('bookings', function ($query) use ($userId) { - /** @var Builder $query */ - $query->where('user_id', $userId); - }); - }); + ->when(auth()->id(), fn ($query, $userId) => $query->orWhereHas('bookings', function ($query) use ($userId): void { + /** @var Builder $query */ + $query->where('user_id', $userId); + })); })->get(); } diff --git a/app/Jobs/EventCleanupReservationsJob.php b/app/Jobs/EventCleanupReservationsJob.php index c3eedd14..eb5e0428 100644 --- a/app/Jobs/EventCleanupReservationsJob.php +++ b/app/Jobs/EventCleanupReservationsJob.php @@ -37,7 +37,7 @@ public function handle(): void { $this->event->bookings() ->whereStatus(BookingStatus::RESERVED->value) - ->each(function (Booking $booking) { + ->each(function (Booking $booking): void { if (now()->greaterThanOrEqualTo($booking->updated_at->addMinutes(10))) { $booking->status = BookingStatus::UNASSIGNED; $booking->user_id = null; diff --git a/app/Jobs/ImportAirportsJob.php b/app/Jobs/ImportAirportsJob.php index 40f54795..4dd7b5fb 100644 --- a/app/Jobs/ImportAirportsJob.php +++ b/app/Jobs/ImportAirportsJob.php @@ -41,7 +41,7 @@ public function handle(): void file_get_contents('https://raw.githubusercontent.com/mborsetti/airportsdata/main/airportsdata/airports.csv') ); (new AirportsImport())->queue($file)->chain([ - function () use ($file) { + function () use ($file): void { Storage::delete($file); } ]); diff --git a/app/Livewire/Bookings.php b/app/Livewire/Bookings.php index a9efa867..39057dca 100644 --- a/app/Livewire/Bookings.php +++ b/app/Livewire/Bookings.php @@ -23,7 +23,7 @@ class Bookings extends Component public function setFilter($filter): void { - $this->filter = strtolower($filter); + $this->filter = strtolower((string) $filter); unset($this->bookings); } @@ -79,17 +79,12 @@ public function bookings() 'flights.airportDep', 'flights.airportArr', ]) - ->withWhereHas('flights', function (Builder|HasMany $query) { - switch ($this->filter) { - case 'departures': - $query->where('dep', $this->event->dep)->orderBy('ctot'); - break; - case 'arrivals': - $query->where('arr', $this->event->arr)->orderBy('eta'); - break; - default: - $query->orderBy('eta')->orderBy('ctot'); - } + ->withWhereHas('flights', function (Builder|HasMany $query): void { + match ($this->filter) { + 'departures' => $query->where('dep', $this->event->dep)->orderBy('ctot'), + 'arrivals' => $query->where('arr', $this->event->arr)->orderBy('eta'), + default => $query->orderBy('eta')->orderBy('ctot'), + }; }) ->get() ->sortBy(function ($booking) { diff --git a/app/Models/Airport.php b/app/Models/Airport.php index 6652fa94..6b6f5f81 100644 --- a/app/Models/Airport.php +++ b/app/Models/Airport.php @@ -62,7 +62,7 @@ class Airport extends Model */ protected static function booted() { - static::addGlobalScope('order', function (Builder $builder) { + static::addGlobalScope('order', function (Builder $builder): void { $builder->orderBy('icao'); }); } @@ -99,12 +99,12 @@ public function links(): HasMany public function setIcaoAttribute($value): void { - $this->attributes['icao'] = strtoupper($value); + $this->attributes['icao'] = strtoupper((string) $value); } public function setIataAttribute($value): void { - $this->attributes['iata'] = strtoupper($value); + $this->attributes['iata'] = strtoupper((string) $value); } public function getFullNameAttribute(): string diff --git a/app/Models/AirportLinkType.php b/app/Models/AirportLinkType.php index 05d7e40b..53527584 100644 --- a/app/Models/AirportLinkType.php +++ b/app/Models/AirportLinkType.php @@ -44,7 +44,7 @@ class AirportLinkType extends Model */ protected static function booted() { - static::addGlobalScope('order', function (Builder $builder) { + static::addGlobalScope('order', function (Builder $builder): void { $builder->orderBy('name'); }); } diff --git a/app/Models/Booking.php b/app/Models/Booking.php index 7d5ae04a..863a3b2c 100644 --- a/app/Models/Booking.php +++ b/app/Models/Booking.php @@ -81,7 +81,7 @@ class Booking extends Model public static function boot(): void { parent::boot(); - self::creating(function ($model) { + self::creating(function ($model): void { $model->uuid = (string)Str::uuid(); }); } @@ -118,17 +118,17 @@ public function getHasReceivedFinalInformationEmailAttribute(): bool public function setCallsignAttribute($value): void { - $this->attributes['callsign'] = !empty($value) ? strtoupper($value) : null; + $this->attributes['callsign'] = !empty($value) ? strtoupper((string) $value) : null; } public function setActypeAttribute($value): void { - $this->attributes['acType'] = !empty($value) ? strtoupper($value) : null; + $this->attributes['acType'] = !empty($value) ? strtoupper((string) $value) : null; } public function setSelcalAttribute($value): void { - $this->attributes['selcal'] = !empty($value) ? strtoupper($value) : null; + $this->attributes['selcal'] = !empty($value) ? strtoupper((string) $value) : null; } public function airportDep(): HasOne @@ -170,7 +170,7 @@ public function airportCtot($orderBy, $withAbbr = true): string public function uniqueAirports(): Collection { $airports = collect(); - $this->flights()->each(function ($flight) use ($airports) { + $this->flights()->each(function ($flight) use ($airports): void { /* @var Flight $flight */ $airports->push($flight->airportDep); $airports->push($flight->airportArr); diff --git a/app/Models/EventType.php b/app/Models/EventType.php index 049b0b05..cf85954c 100644 --- a/app/Models/EventType.php +++ b/app/Models/EventType.php @@ -38,7 +38,7 @@ class EventType extends Model */ protected static function booted() { - static::addGlobalScope('order', function (Builder $builder) { + static::addGlobalScope('order', function (Builder $builder): void { $builder->orderBy('name'); }); } diff --git a/app/Models/Flight.php b/app/Models/Flight.php index 093f94cf..3eaf32ab 100644 --- a/app/Models/Flight.php +++ b/app/Models/Flight.php @@ -115,12 +115,12 @@ public function getFormattedNotesAttribute(): string public function setRouteAttribute($value): void { - $this->attributes['route'] = !empty($value) ? strtoupper($value) : null; + $this->attributes['route'] = !empty($value) ? strtoupper((string) $value) : null; } public function setOceanictrackAttribute($value): void { - $this->attributes['oceanicTrack'] = !empty($value) ? strtoupper($value) : null; + $this->attributes['oceanicTrack'] = !empty($value) ? strtoupper((string) $value) : null; } public function booking(): BelongsTo diff --git a/app/Notifications/BookingCancelled.php b/app/Notifications/BookingCancelled.php index 9fcd106b..9f839246 100644 --- a/app/Notifications/BookingCancelled.php +++ b/app/Notifications/BookingCancelled.php @@ -25,10 +25,9 @@ public function __construct(public Event $event) /** * Get the notification's delivery channels. * - * @param mixed $notifiable * @return array */ - public function via($notifiable) + public function via(mixed $notifiable) { return ['mail']; } @@ -36,10 +35,9 @@ public function via($notifiable) /** * Get the mail representation of the notification. * - * @param mixed $notifiable * @return MailMessage */ - public function toMail($notifiable) + public function toMail(mixed $notifiable) { $eventName = $this->event->name; $subject = $eventName . ': ' . __('Booking cancelled'); @@ -54,10 +52,9 @@ public function toMail($notifiable) /** * Get the array representation of the notification. * - * @param mixed $notifiable * @return array */ - public function toArray($notifiable) + public function toArray(mixed $notifiable) { return [ 'event_id' => $this->event->id, diff --git a/app/Notifications/BookingChanged.php b/app/Notifications/BookingChanged.php index 9571b7e1..eca80319 100644 --- a/app/Notifications/BookingChanged.php +++ b/app/Notifications/BookingChanged.php @@ -26,10 +26,9 @@ public function __construct(public Booking $booking, public Collection $changes) /** * Get the notification's delivery channels. * - * @param mixed $notifiable * @return array */ - public function via($notifiable) + public function via(mixed $notifiable) { return ['mail']; } @@ -37,10 +36,9 @@ public function via($notifiable) /** * Get the mail representation of the notification. * - * @param mixed $notifiable * @return MailMessage */ - public function toMail($notifiable) + public function toMail(mixed $notifiable) { $booking = $this->booking; $subject = $booking->event->name . ': ' . __('Booking changed'); @@ -54,10 +52,9 @@ public function toMail($notifiable) /** * Get the array representation of the notification. * - * @param mixed $notifiable * @return array */ - public function toArray($notifiable) + public function toArray(mixed $notifiable) { return [ // diff --git a/app/Notifications/BookingConfirmed.php b/app/Notifications/BookingConfirmed.php index 40d11e1a..ca5b98c5 100644 --- a/app/Notifications/BookingConfirmed.php +++ b/app/Notifications/BookingConfirmed.php @@ -25,10 +25,9 @@ public function __construct(public Booking $booking) /** * Get the notification's delivery channels. * - * @param mixed $notifiable * @return array */ - public function via($notifiable) + public function via(mixed $notifiable) { return ['mail']; } @@ -36,10 +35,9 @@ public function via($notifiable) /** * Get the mail representation of the notification. * - * @param mixed $notifiable * @return MailMessage */ - public function toMail($notifiable) + public function toMail(mixed $notifiable) { $booking = $this->booking; $subject = $booking->event->name . ': ' . __('Booking confirmed'); @@ -52,10 +50,9 @@ public function toMail($notifiable) /** * Get the array representation of the notification. * - * @param mixed $notifiable * @return array */ - public function toArray($notifiable) + public function toArray(mixed $notifiable) { return [ // diff --git a/app/Notifications/BookingDeleted.php b/app/Notifications/BookingDeleted.php index 4aa4aa6e..36969d12 100644 --- a/app/Notifications/BookingDeleted.php +++ b/app/Notifications/BookingDeleted.php @@ -25,10 +25,9 @@ public function __construct(public Event $event) /** * Get the notification's delivery channels. * - * @param mixed $notifiable * @return array */ - public function via($notifiable) + public function via(mixed $notifiable) { return ['mail']; } @@ -36,10 +35,9 @@ public function via($notifiable) /** * Get the mail representation of the notification. * - * @param mixed $notifiable * @return MailMessage */ - public function toMail($notifiable) + public function toMail(mixed $notifiable) { $event = $this->event; $subject = $event->name . ': ' . __('Booking deleted'); @@ -56,10 +54,9 @@ public function toMail($notifiable) /** * Get the array representation of the notification. * - * @param mixed $notifiable * @return array */ - public function toArray($notifiable) + public function toArray(mixed $notifiable) { return [ 'event_id' => $this->event->id, diff --git a/app/Notifications/EventBulkEmail.php b/app/Notifications/EventBulkEmail.php index 68498a8c..24a2cf77 100644 --- a/app/Notifications/EventBulkEmail.php +++ b/app/Notifications/EventBulkEmail.php @@ -25,10 +25,9 @@ public function __construct(public Event $event, public string $subject, public /** * Get the notification's delivery channels. * - * @param mixed $notifiable * @return array */ - public function via($notifiable) + public function via(mixed $notifiable) { return ['mail']; } @@ -36,10 +35,9 @@ public function via($notifiable) /** * Get the mail representation of the notification. * - * @param mixed $notifiable * @return MailMessage */ - public function toMail($notifiable) + public function toMail(mixed $notifiable) { $subject = $this->event->name . ': ' . $this->subject; $content = $this->content; @@ -55,10 +53,9 @@ public function toMail($notifiable) /** * Get the array representation of the notification. * - * @param mixed $notifiable * @return array */ - public function toArray($notifiable) + public function toArray(mixed $notifiable) { return [ 'user_id' => $notifiable->id, diff --git a/app/Notifications/EventFinalInformation.php b/app/Notifications/EventFinalInformation.php index 2523de10..67453b22 100644 --- a/app/Notifications/EventFinalInformation.php +++ b/app/Notifications/EventFinalInformation.php @@ -26,10 +26,9 @@ public function __construct(public Booking $booking) /** * Get the notification's delivery channels. * - * @param mixed $notifiable * @return array */ - public function via($notifiable) + public function via(mixed $notifiable) { return ['mail']; } @@ -37,10 +36,9 @@ public function via($notifiable) /** * Get the mail representation of the notification. * - * @param mixed $notifiable * @return MailMessage */ - public function toMail($notifiable) + public function toMail(mixed $notifiable) { $booking = $this->booking; $subject = $booking->event->name . ': ' . __('Booking confirmed'); @@ -54,10 +52,9 @@ public function toMail($notifiable) /** * Get the array representation of the notification. * - * @param mixed $notifiable * @return array */ - public function toArray($notifiable) + public function toArray(mixed $notifiable) { return [ $this->booking diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 7668ba26..dc75dbb7 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -13,23 +13,23 @@ class EventServiceProvider extends ServiceProvider * @var array */ protected $listen = [ - 'App\Events\BookingConfirmed' => [ - 'App\Listeners\SendBookingConfirmedNotification', + \App\Events\BookingConfirmed::class => [ + \App\Listeners\SendBookingConfirmedNotification::class, ], - 'App\Events\BookingCancelled' => [ - 'App\Listeners\SendBookingCancelledNotification', + \App\Events\BookingCancelled::class => [ + \App\Listeners\SendBookingCancelledNotification::class, ], - 'App\Events\BookingChanged' => [ - 'App\Listeners\SendBookingChangedNotification', + \App\Events\BookingChanged::class => [ + \App\Listeners\SendBookingChangedNotification::class, ], - 'App\Events\BookingDeleted' => [ - 'App\Listeners\SendBookingDeletedNotification', + \App\Events\BookingDeleted::class => [ + \App\Listeners\SendBookingDeletedNotification::class, ], - 'App\Events\EventBulkEmail' => [ - 'App\Listeners\SendEventBulkEmailNotification', + \App\Events\EventBulkEmail::class => [ + \App\Listeners\SendEventBulkEmailNotification::class, ], - 'App\Events\EventFinalInformation' => [ - 'App\Listeners\SendEventFinalInformationNotification', + \App\Events\EventFinalInformation::class => [ + \App\Listeners\SendEventFinalInformationNotification::class, ] ]; diff --git a/app/Providers/HorizonServiceProvider.php b/app/Providers/HorizonServiceProvider.php index aeb95ce8..46bc3fb4 100644 --- a/app/Providers/HorizonServiceProvider.php +++ b/app/Providers/HorizonServiceProvider.php @@ -33,8 +33,6 @@ public function boot(): void */ protected function gate() { - Gate::define('viewHorizon', function ($user) { - return $user->isAdmin; - }); + Gate::define('viewHorizon', fn ($user) => $user->isAdmin); } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index fab29bf1..bd1403ad 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -28,7 +28,7 @@ public function boot(): void { $this->configureRateLimiting(); - $this->routes(function () { + $this->routes(function (): void { Route::middleware('api') ->prefix('api') ->group(base_path('routes/api.php')); @@ -45,8 +45,6 @@ public function boot(): void */ protected function configureRateLimiting() { - RateLimiter::for('api', function (Request $request) { - return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); - }); + RateLimiter::for('api', fn (Request $request) => Limit::perMinute(60)->by($request->user()?->id ?: $request->ip())); } } diff --git a/app/Providers/TelescopeServiceProvider.php b/app/Providers/TelescopeServiceProvider.php index b782b731..9403e02d 100644 --- a/app/Providers/TelescopeServiceProvider.php +++ b/app/Providers/TelescopeServiceProvider.php @@ -62,8 +62,6 @@ protected function hideSensitiveRequestDetails() */ protected function gate() { - Gate::define('viewTelescope', function ($user) { - return $user->isAdmin; - }); + Gate::define('viewTelescope', fn ($user) => $user->isAdmin); } } diff --git a/app/Providers/ViewServiceProvider.php b/app/Providers/ViewServiceProvider.php index c8a54efa..8e9f7aa3 100644 --- a/app/Providers/ViewServiceProvider.php +++ b/app/Providers/ViewServiceProvider.php @@ -23,6 +23,6 @@ public function register(): void */ public function boot(): void { - view()->composer('layouts.navbar', 'App\Http\View\Composers\EventsComposer'); + view()->composer('layouts.navbar', \App\Http\View\Composers\EventsComposer::class); } } diff --git a/config/ide-helper.php b/config/ide-helper.php index 0ed590d0..79bb93e7 100644 --- a/config/ide-helper.php +++ b/config/ide-helper.php @@ -178,8 +178,8 @@ */ 'extra' => [ - 'Eloquent' => ['Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'], - 'Session' => ['Illuminate\Session\Store'], + 'Eloquent' => [\Illuminate\Database\Eloquent\Builder::class, \Illuminate\Database\Query\Builder::class], + 'Session' => [\Illuminate\Session\Store::class], ], 'magic' => [], diff --git a/config/oauth.php b/config/oauth.php index 8e7f2ad6..404ed14e 100644 --- a/config/oauth.php +++ b/config/oauth.php @@ -1,5 +1,5 @@ - explode(',', env('OAUTH_SCOPES', 'full_name,email')), + 'scopes' => explode(',', (string) env('OAUTH_SCOPES', 'full_name,email')), /* * OAuth variable mapping diff --git a/database/factories/BookingFactory.php b/database/factories/BookingFactory.php index 30ce7b81..04bb10fd 100644 --- a/database/factories/BookingFactory.php +++ b/database/factories/BookingFactory.php @@ -35,11 +35,9 @@ public function definition() */ public function unassigned() { - return $this->state(function () { - return [ - 'status' => BookingStatus::UNASSIGNED, - ]; - }); + return $this->state(fn () => [ + 'status' => BookingStatus::UNASSIGNED, + ]); } /** @@ -49,11 +47,9 @@ public function unassigned() */ public function reserved() { - return $this->state(function () { - return [ - 'status' => BookingStatus::RESERVED, - ]; - }); + return $this->state(fn () => [ + 'status' => BookingStatus::RESERVED, + ]); } /** @@ -63,10 +59,8 @@ public function reserved() */ public function booked() { - return $this->state(function () { - return [ - 'status' => BookingStatus::BOOKED, - ]; - }); + return $this->state(fn () => [ + 'status' => BookingStatus::BOOKED, + ]); } } diff --git a/database/factories/EventFactory.php b/database/factories/EventFactory.php index b4d44c16..9aae6ed1 100644 --- a/database/factories/EventFactory.php +++ b/database/factories/EventFactory.php @@ -40,31 +40,25 @@ public function definition() public function expired() { - return $this->state(function (array $attributes) { - return [ - 'startEvent' => now()->subMonth(), - 'endEvent' => now()->subMonth()->addHours(3), - 'startBooking' => now()->subWeek(), - 'endBooking' => now()->subMonth()->subHours(12), - ]; - }); + return $this->state(fn (array $attributes) => [ + 'startEvent' => now()->subMonth(), + 'endEvent' => now()->subMonth()->addHours(3), + 'startBooking' => now()->subWeek(), + 'endBooking' => now()->subMonth()->subHours(12), + ]); } public function onHomePage() { - return $this->state(function (array $attributes) { - return [ - 'show_on_homepage' => true, - ]; - }); + return $this->state(fn (array $attributes) => [ + 'show_on_homepage' => true, + ]); } public function notOnHomePage() { - return $this->state(function (array $attributes) { - return [ - 'show_on_homepage' => false, - ]; - }); + return $this->state(fn (array $attributes) => [ + 'show_on_homepage' => false, + ]); } } diff --git a/database/factories/FaqFactory.php b/database/factories/FaqFactory.php index 66c246e4..4ad7f581 100644 --- a/database/factories/FaqFactory.php +++ b/database/factories/FaqFactory.php @@ -29,10 +29,8 @@ public function definition() public function offline() { - return $this->state(function (array $attributes) { - return [ - 'is_online' => false, - ]; - }); + return $this->state(fn (array $attributes) => [ + 'is_online' => false, + ]); } } diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 6cf41726..1a0558c3 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -32,46 +32,36 @@ public function definition() public function admin() { - return $this->state(function (array $attributes) { - return [ - 'isAdmin' => true, - ]; - }); + return $this->state(fn (array $attributes) => [ + 'isAdmin' => true, + ]); } public function airportViewName() { - return $this->state(function (array $attributes) { - return [ - 'airport_view' => AirportView::NAME, - ]; - }); + return $this->state(fn (array $attributes) => [ + 'airport_view' => AirportView::NAME, + ]); } public function airportViewIcao() { - return $this->state(function (array $attributes) { - return [ - 'airport_view' => AirportView::ICAO, - ]; - }); + return $this->state(fn (array $attributes) => [ + 'airport_view' => AirportView::ICAO, + ]); } public function airportViewIata() { - return $this->state(function (array $attributes) { - return [ - 'airport_view' => AirportView::IATA, - ]; - }); + return $this->state(fn (array $attributes) => [ + 'airport_view' => AirportView::IATA, + ]); } public function monospaceFont() { - return $this->state(function (array $attributes) { - return [ - 'monospace_font' => true, - ]; - }); + return $this->state(fn (array $attributes) => [ + 'monospace_font' => true, + ]); } } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index b38b3737..a62f0558 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -13,7 +13,7 @@ class CreateUsersTable extends Migration */ public function up() { - Schema::create('users', function (Blueprint $table) { + Schema::create('users', function (Blueprint $table): void { $table->unsignedInteger('id')->primary(); $table->string('name_first', 50); $table->string('name_last', 50); diff --git a/database/migrations/2018_06_06_172719_create_airports_table.php b/database/migrations/2018_06_06_172719_create_airports_table.php index 5ab949e7..ce00d820 100644 --- a/database/migrations/2018_06_06_172719_create_airports_table.php +++ b/database/migrations/2018_06_06_172719_create_airports_table.php @@ -13,7 +13,7 @@ class CreateAirportsTable extends Migration */ public function up() { - Schema::create('airports', function (Blueprint $table) { + Schema::create('airports', function (Blueprint $table): void { // Can't use id() because that uses bigIncrements since Laravel 6, which might break existing envs at one point. $table->unsignedInteger('id')->autoIncrement(); $table->string('icao')->unique(); diff --git a/database/migrations/2018_06_06_174837_create_events_table.php b/database/migrations/2018_06_06_174837_create_events_table.php index d4cb37c3..e055294f 100644 --- a/database/migrations/2018_06_06_174837_create_events_table.php +++ b/database/migrations/2018_06_06_174837_create_events_table.php @@ -13,7 +13,7 @@ class CreateEventsTable extends Migration */ public function up() { - Schema::create('events', function (Blueprint $table) { + Schema::create('events', function (Blueprint $table): void { $table->increments('id'); $table->string('name'); $table->string('slug'); diff --git a/database/migrations/2018_06_06_182242_create_bookings_table.php b/database/migrations/2018_06_06_182242_create_bookings_table.php index d4270467..e4dc4bed 100644 --- a/database/migrations/2018_06_06_182242_create_bookings_table.php +++ b/database/migrations/2018_06_06_182242_create_bookings_table.php @@ -13,7 +13,7 @@ class CreateBookingsTable extends Migration */ public function up() { - Schema::create('bookings', function (Blueprint $table) { + Schema::create('bookings', function (Blueprint $table): void { $table->increments('id'); $table->unsignedInteger('event_id'); $table->unsignedInteger('user_id')->nullable(); diff --git a/database/migrations/2018_06_08_163042_add_foreign_keys_to_bookings_table.php b/database/migrations/2018_06_08_163042_add_foreign_keys_to_bookings_table.php index 02ddc74e..5b7e0f35 100644 --- a/database/migrations/2018_06_08_163042_add_foreign_keys_to_bookings_table.php +++ b/database/migrations/2018_06_08_163042_add_foreign_keys_to_bookings_table.php @@ -13,7 +13,7 @@ class AddForeignKeysToBookingsTable extends Migration */ public function up() { - Schema::table('bookings', function (Blueprint $table) { + Schema::table('bookings', function (Blueprint $table): void { $table->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); $table->foreign('user_id')->references('id')->on('users'); }); @@ -26,7 +26,7 @@ public function up() */ public function down() { - Schema::table('bookings', function (Blueprint $table) { + Schema::table('bookings', function (Blueprint $table): void { $table->dropForeign(['event_id']); $table->dropForeign(['user_id']); }); diff --git a/database/migrations/2018_06_16_205218_create_jobs_table.php b/database/migrations/2018_06_16_205218_create_jobs_table.php index 58d77154..7604b111 100644 --- a/database/migrations/2018_06_16_205218_create_jobs_table.php +++ b/database/migrations/2018_06_16_205218_create_jobs_table.php @@ -13,7 +13,7 @@ class CreateJobsTable extends Migration */ public function up() { - Schema::create('jobs', function (Blueprint $table) { + Schema::create('jobs', function (Blueprint $table): void { $table->bigIncrements('id'); $table->string('queue')->index(); $table->longText('payload'); diff --git a/database/migrations/2018_06_17_114535_create_failed_jobs_table.php b/database/migrations/2018_06_17_114535_create_failed_jobs_table.php index d432dff0..ee31351c 100644 --- a/database/migrations/2018_06_17_114535_create_failed_jobs_table.php +++ b/database/migrations/2018_06_17_114535_create_failed_jobs_table.php @@ -13,7 +13,7 @@ class CreateFailedJobsTable extends Migration */ public function up() { - Schema::create('failed_jobs', function (Blueprint $table) { + Schema::create('failed_jobs', function (Blueprint $table): void { $table->bigIncrements('id'); $table->text('connection'); $table->text('queue'); diff --git a/database/migrations/2018_07_28_140133_set_form_sent_default_to_false.php b/database/migrations/2018_07_28_140133_set_form_sent_default_to_false.php index 3f318568..669162b7 100644 --- a/database/migrations/2018_07_28_140133_set_form_sent_default_to_false.php +++ b/database/migrations/2018_07_28_140133_set_form_sent_default_to_false.php @@ -13,7 +13,7 @@ class SetFormSentDefaultToFalse extends Migration */ public function up() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->boolean('formSent')->default(0)->change(); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->boolean('formSent')->default(1)->change(); }); } diff --git a/database/migrations/2018_07_30_170822_add_uuid_to_bookings_table.php b/database/migrations/2018_07_30_170822_add_uuid_to_bookings_table.php index a4a136e7..f42cf65d 100644 --- a/database/migrations/2018_07_30_170822_add_uuid_to_bookings_table.php +++ b/database/migrations/2018_07_30_170822_add_uuid_to_bookings_table.php @@ -14,7 +14,7 @@ class AddUuidToBookingsTable extends Migration */ public function up() { - Schema::table('bookings', function (Blueprint $table) { + Schema::table('bookings', function (Blueprint $table): void { $table->uuid('uuid')->after('id')->nullable()->unique(); $table->index('uuid'); }); @@ -31,7 +31,7 @@ public function up() */ public function down() { - Schema::table('bookings', function (Blueprint $table) { + Schema::table('bookings', function (Blueprint $table): void { $table->dropColumn('uuid'); }); } diff --git a/database/migrations/2018_09_12_155540_add_status_to_bookings_table.php b/database/migrations/2018_09_12_155540_add_status_to_bookings_table.php index 9559b3a5..5ee5f999 100644 --- a/database/migrations/2018_09_12_155540_add_status_to_bookings_table.php +++ b/database/migrations/2018_09_12_155540_add_status_to_bookings_table.php @@ -14,7 +14,7 @@ class AddStatusToBookingsTable extends Migration */ public function up() { - Schema::table('bookings', function (Blueprint $table) { + Schema::table('bookings', function (Blueprint $table): void { $table->tinyInteger('status')->unsigned()->after('event_id')->default(BookingStatus::UNASSIGNED); }); } @@ -26,7 +26,7 @@ public function up() */ public function down() { - Schema::table('bookings', function (Blueprint $table) { + Schema::table('bookings', function (Blueprint $table): void { $table->dropColumn('status'); }); } diff --git a/database/migrations/2018_09_13_065730_create_airport_link_types_table.php b/database/migrations/2018_09_13_065730_create_airport_link_types_table.php index 19f00f99..ac91f9b1 100644 --- a/database/migrations/2018_09_13_065730_create_airport_link_types_table.php +++ b/database/migrations/2018_09_13_065730_create_airport_link_types_table.php @@ -13,7 +13,7 @@ class CreateAirportLinkTypesTable extends Migration */ public function up() { - Schema::create('airport_link_types', function (Blueprint $table) { + Schema::create('airport_link_types', function (Blueprint $table): void { $table->increments('id'); $table->string('name'); $table->string('class')->nullable(); diff --git a/database/migrations/2018_09_13_065748_create_airport_links_table.php b/database/migrations/2018_09_13_065748_create_airport_links_table.php index f6c40215..8f484cf9 100644 --- a/database/migrations/2018_09_13_065748_create_airport_links_table.php +++ b/database/migrations/2018_09_13_065748_create_airport_links_table.php @@ -13,7 +13,7 @@ class CreateAirportLinksTable extends Migration */ public function up() { - Schema::create('airport_links', function (Blueprint $table) { + Schema::create('airport_links', function (Blueprint $table): void { $table->increments('id'); $table->unsignedInteger('airport_id'); $table->unsignedInteger('airportLinkType_id'); @@ -23,7 +23,7 @@ public function up() $table->softDeletes(); }); - Schema::table('airport_links', function (Blueprint $table) { + Schema::table('airport_links', function (Blueprint $table): void { $table->foreign('airport_id')->references('id')->on('airports')->onDelete('cascade'); $table->foreign('airportLinkType_id')->references('id')->on('airport_link_types')->onDelete('cascade'); }); @@ -36,7 +36,7 @@ public function up() */ public function down() { - Schema::table('airport_links', function (Blueprint $table) { + Schema::table('airport_links', function (Blueprint $table): void { $table->dropForeign(['airport_id']); $table->dropForeign(['airportLinkType_id']); }); diff --git a/database/migrations/2018_09_16_141549_create_event_types_table.php b/database/migrations/2018_09_16_141549_create_event_types_table.php index 75e86cb6..41d6763c 100644 --- a/database/migrations/2018_09_16_141549_create_event_types_table.php +++ b/database/migrations/2018_09_16_141549_create_event_types_table.php @@ -13,7 +13,7 @@ class CreateEventTypesTable extends Migration */ public function up() { - Schema::create('event_types', function (Blueprint $table) { + Schema::create('event_types', function (Blueprint $table): void { $table->unsignedTinyInteger('id')->primary(); $table->string('name'); }); diff --git a/database/migrations/2018_09_16_141648_add_event_type_to_events_table.php b/database/migrations/2018_09_16_141648_add_event_type_to_events_table.php index a2019392..998220d0 100644 --- a/database/migrations/2018_09_16_141648_add_event_type_to_events_table.php +++ b/database/migrations/2018_09_16_141648_add_event_type_to_events_table.php @@ -14,11 +14,11 @@ class AddEventTypeToEventsTable extends Migration */ public function up() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->tinyInteger('event_type_id')->unsigned()->after('id')->default(EventType::ONEWAY); }); - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->foreign('event_type_id')->references('id')->on('event_types'); }); } @@ -30,7 +30,7 @@ public function up() */ public function down() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->dropForeign(['event_type_id']); $table->dropColumn('event_type_id'); }); diff --git a/database/migrations/2018_09_16_204959_add_airports_to_events_table.php b/database/migrations/2018_09_16_204959_add_airports_to_events_table.php index 051ce839..9a82c850 100644 --- a/database/migrations/2018_09_16_204959_add_airports_to_events_table.php +++ b/database/migrations/2018_09_16_204959_add_airports_to_events_table.php @@ -13,12 +13,12 @@ class AddAirportsToEventsTable extends Migration */ public function up() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->unsignedInteger('arr')->after('description')->nullable(); $table->unsignedInteger('dep')->after('description')->nullable(); }); - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->foreign('dep')->references('id')->on('airports'); $table->foreign('arr')->references('id')->on('airports'); }); @@ -31,7 +31,7 @@ public function up() */ public function down() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->dropForeign(['dep']); $table->dropForeign(['arr']); $table->dropColumn(['dep', 'arr']); diff --git a/database/migrations/2018_09_24_093421_remove_feedback_from_events_table.php b/database/migrations/2018_09_24_093421_remove_feedback_from_events_table.php index 1e2be0f9..92893ef0 100644 --- a/database/migrations/2018_09_24_093421_remove_feedback_from_events_table.php +++ b/database/migrations/2018_09_24_093421_remove_feedback_from_events_table.php @@ -13,7 +13,7 @@ class RemoveFeedbackFromEventsTable extends Migration */ public function up() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->dropColumn(['sendFeedbackForm', 'formSent']); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->boolean('formSent')->default(0)->after('endBooking'); $table->dateTime('sendFeedbackForm')->nullable()->after('endBooking'); }); diff --git a/database/migrations/2018_09_30_131714_add_event_variables_to_events_table.php b/database/migrations/2018_09_30_131714_add_event_variables_to_events_table.php index 50a577db..d4940613 100644 --- a/database/migrations/2018_09_30_131714_add_event_variables_to_events_table.php +++ b/database/migrations/2018_09_30_131714_add_event_variables_to_events_table.php @@ -13,7 +13,7 @@ class AddEventVariablesToEventsTable extends Migration */ public function up() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->boolean('is_oceanic_event')->default(false)->after('endBooking'); $table->boolean('multiple_bookings_allowed')->default(true)->after('endBooking'); $table->boolean('uses_times')->default(false)->after('endBooking'); @@ -28,7 +28,7 @@ public function up() */ public function down() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->dropColumn(['is_oceanic_event', 'multiple_bookings_allowed', 'uses_times', 'import_only']); }); } diff --git a/database/migrations/2018_10_08_184552_add_image_url_to_events_table.php b/database/migrations/2018_10_08_184552_add_image_url_to_events_table.php index bcffb87a..f1b8234e 100644 --- a/database/migrations/2018_10_08_184552_add_image_url_to_events_table.php +++ b/database/migrations/2018_10_08_184552_add_image_url_to_events_table.php @@ -13,7 +13,7 @@ class AddImageUrlToEventsTable extends Migration */ public function up() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->string('image_url')->after('slug')->nullable(); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->dropColumn('image_url'); }); } diff --git a/database/migrations/2018_11_23_211958_make_division_nullable_from_users_table.php b/database/migrations/2018_11_23_211958_make_division_nullable_from_users_table.php index d115fd98..09056bdf 100644 --- a/database/migrations/2018_11_23_211958_make_division_nullable_from_users_table.php +++ b/database/migrations/2018_11_23_211958_make_division_nullable_from_users_table.php @@ -13,7 +13,7 @@ class MakeDivisionNullableFromUsersTable extends Migration */ public function up() { - Schema::table('users', function (Blueprint $table) { + Schema::table('users', function (Blueprint $table): void { $table->string('division')->nullable()->change(); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('users', function (Blueprint $table) { + Schema::table('users', function (Blueprint $table): void { $table->string('division')->change(); }); } diff --git a/database/migrations/2018_12_04_191327_add_airport_view_to_users_table.php b/database/migrations/2018_12_04_191327_add_airport_view_to_users_table.php index 7d3ab65d..95dccb38 100644 --- a/database/migrations/2018_12_04_191327_add_airport_view_to_users_table.php +++ b/database/migrations/2018_12_04_191327_add_airport_view_to_users_table.php @@ -14,7 +14,7 @@ class AddAirportViewToUsersTable extends Migration */ public function up() { - Schema::table('users', function (Blueprint $table) { + Schema::table('users', function (Blueprint $table): void { $table->tinyInteger('airport_view')->after('isAdmin')->default(AirportView::NAME); }); } @@ -26,7 +26,7 @@ public function up() */ public function down() { - Schema::table('users', function (Blueprint $table) { + Schema::table('users', function (Blueprint $table): void { $table->dropColumn('airport_view'); }); } diff --git a/database/migrations/2018_12_04_193038_add_monospace_font_to_users_table.php b/database/migrations/2018_12_04_193038_add_monospace_font_to_users_table.php index 0ed7fd40..35a46f09 100644 --- a/database/migrations/2018_12_04_193038_add_monospace_font_to_users_table.php +++ b/database/migrations/2018_12_04_193038_add_monospace_font_to_users_table.php @@ -13,7 +13,7 @@ class AddMonospaceFontToUsersTable extends Migration */ public function up() { - Schema::table('users', function (Blueprint $table) { + Schema::table('users', function (Blueprint $table): void { $table->boolean('use_monospace_font')->after('airport_view')->default(false); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('users', function (Blueprint $table) { + Schema::table('users', function (Blueprint $table): void { $table->dropColumn('use_monospace_font'); }); } diff --git a/database/migrations/2018_12_10_214244_create_notifications_table.php b/database/migrations/2018_12_10_214244_create_notifications_table.php index fb16d5bc..5a83579c 100644 --- a/database/migrations/2018_12_10_214244_create_notifications_table.php +++ b/database/migrations/2018_12_10_214244_create_notifications_table.php @@ -13,7 +13,7 @@ class CreateNotificationsTable extends Migration */ public function up() { - Schema::create('notifications', function (Blueprint $table) { + Schema::create('notifications', function (Blueprint $table): void { $table->uuid('id')->primary(); $table->string('type'); $table->morphs('notifiable'); diff --git a/database/migrations/2018_12_16_154113_create_activity_log_table.php b/database/migrations/2018_12_16_154113_create_activity_log_table.php index 7ba5fa7b..d7cf2dac 100644 --- a/database/migrations/2018_12_16_154113_create_activity_log_table.php +++ b/database/migrations/2018_12_16_154113_create_activity_log_table.php @@ -11,7 +11,7 @@ class CreateActivityLogTable extends Migration */ public function up() { - Schema::create(config('activitylog.table_name'), function (Blueprint $table) { + Schema::create(config('activitylog.table_name'), function (Blueprint $table): void { $table->increments('id'); $table->string('log_name')->nullable(); $table->text('description'); diff --git a/database/migrations/2019_02_13_204936_create_faqs_table.php b/database/migrations/2019_02_13_204936_create_faqs_table.php index d33bc752..91e963dd 100644 --- a/database/migrations/2019_02_13_204936_create_faqs_table.php +++ b/database/migrations/2019_02_13_204936_create_faqs_table.php @@ -13,7 +13,7 @@ class CreateFaqsTable extends Migration */ public function up() { - Schema::create('faqs', function (Blueprint $table) { + Schema::create('faqs', function (Blueprint $table): void { $table->increments('id'); $table->boolean('is_online')->default(true); $table->string('question'); diff --git a/database/migrations/2019_02_13_210046_create_event_faq_table.php b/database/migrations/2019_02_13_210046_create_event_faq_table.php index bbf4693e..4abef96d 100644 --- a/database/migrations/2019_02_13_210046_create_event_faq_table.php +++ b/database/migrations/2019_02_13_210046_create_event_faq_table.php @@ -13,7 +13,7 @@ class CreateEventFaqTable extends Migration */ public function up() { - Schema::create('event_faq', function (Blueprint $table) { + Schema::create('event_faq', function (Blueprint $table): void { $table->increments('id'); $table->unsignedInteger('event_id')->index(); $table->unsignedInteger('faq_id')->index(); diff --git a/database/migrations/2019_03_09_173511_add_isonline_to_events_table.php b/database/migrations/2019_03_09_173511_add_isonline_to_events_table.php index 8b6b069c..d8c688e9 100644 --- a/database/migrations/2019_03_09_173511_add_isonline_to_events_table.php +++ b/database/migrations/2019_03_09_173511_add_isonline_to_events_table.php @@ -13,7 +13,7 @@ class AddIsonlineToEventsTable extends Migration */ public function up() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->boolean('is_online')->after('event_type_id')->default(true); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->dropColumn('is_online'); }); } diff --git a/database/migrations/2019_07_27_090129_add_iseditable_to_bookings_table.php b/database/migrations/2019_07_27_090129_add_iseditable_to_bookings_table.php index fcea83a2..39d01ae2 100644 --- a/database/migrations/2019_07_27_090129_add_iseditable_to_bookings_table.php +++ b/database/migrations/2019_07_27_090129_add_iseditable_to_bookings_table.php @@ -13,7 +13,7 @@ class AddIseditableToBookingsTable extends Migration */ public function up() { - Schema::table('bookings', function (Blueprint $table) { + Schema::table('bookings', function (Blueprint $table): void { $table->boolean('is_editable')->after('status')->default(false); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('bookings', function (Blueprint $table) { + Schema::table('bookings', function (Blueprint $table): void { $table->dropColumn('is_editable'); }); } diff --git a/database/migrations/2019_08_10_085032_add_show_on_homepage_to_events_table.php b/database/migrations/2019_08_10_085032_add_show_on_homepage_to_events_table.php index a883e447..0e6564de 100644 --- a/database/migrations/2019_08_10_085032_add_show_on_homepage_to_events_table.php +++ b/database/migrations/2019_08_10_085032_add_show_on_homepage_to_events_table.php @@ -13,7 +13,7 @@ class AddShowOnHomepageToEventsTable extends Migration */ public function up() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->boolean('show_on_homepage')->after('is_online')->default(true); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('events', function (Blueprint $table) { + Schema::table('events', function (Blueprint $table): void { $table->dropColumn('show_on_homepage'); }); } diff --git a/database/migrations/2019_12_28_095749_create_flights_table.php b/database/migrations/2019_12_28_095749_create_flights_table.php index 7a0673be..12a5c264 100644 --- a/database/migrations/2019_12_28_095749_create_flights_table.php +++ b/database/migrations/2019_12_28_095749_create_flights_table.php @@ -13,7 +13,7 @@ class CreateFlightsTable extends Migration */ public function up() { - Schema::create('flights', function (Blueprint $table) { + Schema::create('flights', function (Blueprint $table): void { $table->bigIncrements('id'); $table->unsignedInteger('booking_id'); $table->smallInteger('order_by')->default(1); diff --git a/database/migrations/2020_01_15_182004_add_notes_to_flights_table.php b/database/migrations/2020_01_15_182004_add_notes_to_flights_table.php index 55e8088a..8e937724 100644 --- a/database/migrations/2020_01_15_182004_add_notes_to_flights_table.php +++ b/database/migrations/2020_01_15_182004_add_notes_to_flights_table.php @@ -13,7 +13,7 @@ class AddNotesToFlightsTable extends Migration */ public function up() { - Schema::table('flights', function (Blueprint $table) { + Schema::table('flights', function (Blueprint $table): void { $table->text('notes')->nullable()->after('route'); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('flights', function (Blueprint $table) { + Schema::table('flights', function (Blueprint $table): void { $table->dropColumn('notes'); }); } diff --git a/database/migrations/2020_01_23_210725_final_information_email_sent_at_to_bookings_table.php b/database/migrations/2020_01_23_210725_final_information_email_sent_at_to_bookings_table.php index a2dd754b..97891715 100644 --- a/database/migrations/2020_01_23_210725_final_information_email_sent_at_to_bookings_table.php +++ b/database/migrations/2020_01_23_210725_final_information_email_sent_at_to_bookings_table.php @@ -13,7 +13,7 @@ class FinalInformationEmailSentAtToBookingsTable extends Migration */ public function up() { - Schema::table('bookings', function (Blueprint $table) { + Schema::table('bookings', function (Blueprint $table): void { $table->dateTime('final_information_email_sent_at')->nullable()->after('selcal'); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('bookings', function (Blueprint $table) { + Schema::table('bookings', function (Blueprint $table): void { $table->dropColumn('final_information_email_sent_at'); }); } diff --git a/database/migrations/2020_04_25_104216_add_connect_columns_to_users_table.php b/database/migrations/2020_04_25_104216_add_connect_columns_to_users_table.php index 6d383ae6..f570dfc7 100644 --- a/database/migrations/2020_04_25_104216_add_connect_columns_to_users_table.php +++ b/database/migrations/2020_04_25_104216_add_connect_columns_to_users_table.php @@ -13,7 +13,7 @@ class AddConnectColumnsToUsersTable extends Migration */ public function up() { - Schema::table('users', function (Blueprint $table) { + Schema::table('users', function (Blueprint $table): void { $table->string('name_first', 191)->change(); $table->string('name_last', 191)->change(); $table->text('access_token')->after('remember_token')->nullable(); @@ -30,7 +30,7 @@ public function up() */ public function down() { - Schema::table('users', function (Blueprint $table) { + Schema::table('users', function (Blueprint $table): void { $table->dropColumn(['token_expires', 'refresh_token', 'access_token']); $table->string('name_first', 50)->change(); $table->string('name_last', 50)->change(); diff --git a/database/migrations/2020_04_25_212747_remove_subdivision_from_users_table.php b/database/migrations/2020_04_25_212747_remove_subdivision_from_users_table.php index def82529..4d45a25f 100644 --- a/database/migrations/2020_04_25_212747_remove_subdivision_from_users_table.php +++ b/database/migrations/2020_04_25_212747_remove_subdivision_from_users_table.php @@ -13,7 +13,7 @@ class RemoveSubdivisionFromUsersTable extends Migration */ public function up() { - Schema::table('users', function (Blueprint $table) { + Schema::table('users', function (Blueprint $table): void { $table->dropColumn('subdivision'); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('users', function (Blueprint $table) { + Schema::table('users', function (Blueprint $table): void { $table->string('subdivision')->nullable(); }); } diff --git a/database/migrations/2020_04_27_152430_make_secret_nullable_in_oauth_clients_table.php b/database/migrations/2020_04_27_152430_make_secret_nullable_in_oauth_clients_table.php index 9ee65bb8..6b2bb166 100644 --- a/database/migrations/2020_04_27_152430_make_secret_nullable_in_oauth_clients_table.php +++ b/database/migrations/2020_04_27_152430_make_secret_nullable_in_oauth_clients_table.php @@ -14,7 +14,7 @@ class MakeSecretNullableInOauthClientsTable extends Migration public function up() { if (Schema::hasTable('oauth_clients')) { - Schema::table('oauth_clients', function (Blueprint $table) { + Schema::table('oauth_clients', function (Blueprint $table): void { $table->string('secret', 100)->nullable()->change(); }); } @@ -28,7 +28,7 @@ public function up() public function down() { if (Schema::hasTable('oauth_clients')) { - Schema::table('oauth_clients', function (Blueprint $table) { + Schema::table('oauth_clients', function (Blueprint $table): void { $table->string('secret', 100)->nullable(false)->change(); }); } diff --git a/database/migrations/2020_08_07_184418_change_route_to_text.php b/database/migrations/2020_08_07_184418_change_route_to_text.php index d9b4e4a3..75c67ecf 100644 --- a/database/migrations/2020_08_07_184418_change_route_to_text.php +++ b/database/migrations/2020_08_07_184418_change_route_to_text.php @@ -13,7 +13,7 @@ class ChangeRouteToText extends Migration */ public function up() { - Schema::table('flights', function (Blueprint $table) { + Schema::table('flights', function (Blueprint $table): void { $table->text('route')->nullable()->change(); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('flights', function (Blueprint $table) { + Schema::table('flights', function (Blueprint $table): void { $table->string('route')->nullable(); }); } diff --git a/database/migrations/2020_10_05_141406_add_uuid_to_failed_jobs_table.php b/database/migrations/2020_10_05_141406_add_uuid_to_failed_jobs_table.php index 7975ad46..b5d63059 100644 --- a/database/migrations/2020_10_05_141406_add_uuid_to_failed_jobs_table.php +++ b/database/migrations/2020_10_05_141406_add_uuid_to_failed_jobs_table.php @@ -13,7 +13,7 @@ class AddUuidToFailedJobsTable extends Migration */ public function up() { - Schema::table('failed_jobs', function (Blueprint $table) { + Schema::table('failed_jobs', function (Blueprint $table): void { $table->string('uuid')->after('id')->nullable()->unique(); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('failed_jobs', function (Blueprint $table) { + Schema::table('failed_jobs', function (Blueprint $table): void { $table->dropColumn('uuid'); }); } diff --git a/database/migrations/2021_01_03_160813_change_oceanic_track_to_text_in_flights_table.php b/database/migrations/2021_01_03_160813_change_oceanic_track_to_text_in_flights_table.php index 67c3f0d8..2816db45 100644 --- a/database/migrations/2021_01_03_160813_change_oceanic_track_to_text_in_flights_table.php +++ b/database/migrations/2021_01_03_160813_change_oceanic_track_to_text_in_flights_table.php @@ -13,7 +13,7 @@ class ChangeOceanicTrackToTextInFlightsTable extends Migration */ public function up() { - Schema::table('flights', function (Blueprint $table) { + Schema::table('flights', function (Blueprint $table): void { $table->text('oceanicTrack')->nullable()->change(); }); } @@ -25,7 +25,7 @@ public function up() */ public function down() { - Schema::table('flights', function (Blueprint $table) { + Schema::table('flights', function (Blueprint $table): void { $table->string('oceanicTrack', 2)->nullable()->change(); }); } diff --git a/database/migrations/2021_01_28_185449_create_event_links_table.php b/database/migrations/2021_01_28_185449_create_event_links_table.php index ef92f260..9680bf70 100644 --- a/database/migrations/2021_01_28_185449_create_event_links_table.php +++ b/database/migrations/2021_01_28_185449_create_event_links_table.php @@ -13,7 +13,7 @@ class CreateEventLinksTable extends Migration */ public function up() { - Schema::create('event_links', function (Blueprint $table) { + Schema::create('event_links', function (Blueprint $table): void { $table->id(); $table->unsignedInteger('event_id'); $table->unsignedInteger('event_link_type_id'); @@ -23,7 +23,7 @@ public function up() }); // We can't use $table->foreignId()->constrained() due to different different datatype - Schema::table('event_links', function (Blueprint $table) { + Schema::table('event_links', function (Blueprint $table): void { $table->foreign('event_id')->references('id')->on('events')->onUpdate('cascade')->onDelete('cascade'); $table->foreign('event_link_type_id')->references('id')->on('airport_link_types')->onUpdate('cascade')->onDelete('cascade'); }); diff --git a/database/migrations/2021_12_18_163517_add_event_column_to_activity_log_table.php b/database/migrations/2021_12_18_163517_add_event_column_to_activity_log_table.php index 7b797fd5..07c5d2cd 100644 --- a/database/migrations/2021_12_18_163517_add_event_column_to_activity_log_table.php +++ b/database/migrations/2021_12_18_163517_add_event_column_to_activity_log_table.php @@ -8,14 +8,14 @@ class AddEventColumnToActivityLogTable extends Migration { public function up() { - Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { + Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table): void { $table->string('event')->nullable()->after('subject_type'); }); } public function down() { - Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { + Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table): void { $table->dropColumn('event'); }); } diff --git a/database/migrations/2021_12_18_163518_add_batch_uuid_column_to_activity_log_table.php b/database/migrations/2021_12_18_163518_add_batch_uuid_column_to_activity_log_table.php index 8f7db665..8d3f9b6f 100644 --- a/database/migrations/2021_12_18_163518_add_batch_uuid_column_to_activity_log_table.php +++ b/database/migrations/2021_12_18_163518_add_batch_uuid_column_to_activity_log_table.php @@ -8,14 +8,14 @@ class AddBatchUuidColumnToActivityLogTable extends Migration { public function up() { - Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { + Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table): void { $table->uuid('batch_uuid')->nullable()->after('properties'); }); } public function down() { - Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) { + Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table): void { $table->dropColumn('batch_uuid'); }); } diff --git a/database/migrations/2022_01_02_125521_add_coordinates_in_airports.php b/database/migrations/2022_01_02_125521_add_coordinates_in_airports.php index 15d17fc9..004a6e92 100644 --- a/database/migrations/2022_01_02_125521_add_coordinates_in_airports.php +++ b/database/migrations/2022_01_02_125521_add_coordinates_in_airports.php @@ -13,7 +13,7 @@ class AddCoordinatesInAirports extends Migration */ public function up() { - Schema::table('airports', function (Blueprint $table) { + Schema::table('airports', function (Blueprint $table): void { $table->double('longitude')->after('name')->nullable(); $table->double('latitude')->after('name')->nullable(); }); @@ -26,7 +26,7 @@ public function up() */ public function down() { - Schema::table('airports', function (Blueprint $table) { + Schema::table('airports', function (Blueprint $table): void { $table->dropColumn(['latitude', 'longitude']); }); } diff --git a/resources/views/vendor/notifications/email.blade.php b/resources/views/vendor/notifications/email.blade.php index e46a284a..56273ada 100644 --- a/resources/views/vendor/notifications/email.blade.php +++ b/resources/views/vendor/notifications/email.blade.php @@ -19,14 +19,10 @@ {{-- Action Button --}} @isset($actionText) $level, + default => 'primary', +}; ?> @component('mail::button', ['url' => $actionUrl, 'color' => $color]) {{ $actionText }} diff --git a/routes/api.php b/routes/api.php index c2f0afff..768ac254 100644 --- a/routes/api.php +++ b/routes/api.php @@ -30,34 +30,20 @@ // return new UsersCollection(User::all()); // }); -Route::get('/events/upcoming/{limit?}', function ($limit = 3) { - return new EventsCollection(Event::where('is_online', true) - ->where('endEvent', '>', now()) - ->orderBy('startEvent', 'asc') - ->limit($limit) - ->get()); -}); - -Route::get('/events/{event}/bookings', function (Event $event) { - return new BookingsCollection($event->bookings->where('status', BookingStatus::BOOKED->value)); -}); - -Route::get('/events/{event}', function (Event $event) { - return new EventResource($event); -}); - -Route::get('/events', function () { - return new EventsCollection(Event::paginate()); -}); - -Route::get('/bookings/{booking}', function (Booking $booking) { - return new BookingResource($booking); -}); - -Route::get('/airports/{airport}', function (Airport $airport) { - return new AirportResource($airport); -}); - -Route::get('/airports', function () { - return new AirportsCollection(Airport::paginate()); -}); +Route::get('/events/upcoming/{limit?}', fn ($limit = 3) => new EventsCollection(Event::where('is_online', true) + ->where('endEvent', '>', now()) + ->orderBy('startEvent', 'asc') + ->limit($limit) + ->get())); + +Route::get('/events/{event}/bookings', fn (Event $event) => new BookingsCollection($event->bookings->where('status', BookingStatus::BOOKED->value))); + +Route::get('/events/{event}', fn (Event $event) => new EventResource($event)); + +Route::get('/events', fn () => new EventsCollection(Event::paginate())); + +Route::get('/bookings/{booking}', fn (Booking $booking) => new BookingResource($booking)); + +Route::get('/airports/{airport}', fn (Airport $airport) => new AirportResource($airport)); + +Route::get('/airports', fn () => new AirportsCollection(Airport::paginate())); diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.php index b5b4c5d9..18a49e21 100644 --- a/routes/breadcrumbs.php +++ b/routes/breadcrumbs.php @@ -1,197 +1,197 @@ push('Home', route('home')); }); // Home > Admin -Breadcrumbs::for('admin', function ($trail) { +Breadcrumbs::for('admin', function ($trail): void { $trail->parent('home'); $trail->push('Admin'); }); // Home > Admin > Airports -Breadcrumbs::for('admin.airports.index', function ($trail) { +Breadcrumbs::for('admin.airports.index', function ($trail): void { $trail->parent('admin'); $trail->push('Airports', route('admin.airports.index')); }); // Home > Admin > Airports > New -Breadcrumbs::for('admin.airports.create', function ($trail) { +Breadcrumbs::for('admin.airports.create', function ($trail): void { $trail->parent('admin.airports.index'); $trail->push('New', route('admin.airports.create')); }); // Home > Admin > Airports > [Airport] -Breadcrumbs::for('admin.airports.show', function ($trail, $airport) { +Breadcrumbs::for('admin.airports.show', function ($trail, $airport): void { $trail->parent('admin.airports.index'); $trail->push($airport->name . ' [' . $airport->icao . ' | ' . $airport->iata . ']', route('admin.airports.show', $airport)); }); // Home > Admin > Airports > [Airport] > Edit Airport -Breadcrumbs::for('admin.airports.edit', function ($trail, $airport) { +Breadcrumbs::for('admin.airports.edit', function ($trail, $airport): void { $trail->parent('admin.airports.show', $airport); $trail->push('Edit Airport', route('admin.airports.edit', $airport)); }); // Home > Admin > Airport Links -Breadcrumbs::for('admin.airportLinks.index', function ($trail) { +Breadcrumbs::for('admin.airportLinks.index', function ($trail): void { $trail->parent('admin'); $trail->push('Airport Links', route('admin.airportLinks.index')); }); // Home > Admin > Airport Links > New -Breadcrumbs::for('admin.airportLinks.create', function ($trail) { +Breadcrumbs::for('admin.airportLinks.create', function ($trail): void { $trail->parent('admin.airportLinks.index'); $trail->push('New', route('admin.airportLinks.create')); }); // Home > Admin > Airports > [Airport] > [Airport Link] > Edit Airport Link -Breadcrumbs::for('admin.airportLinks.edit', function ($trail, $airportLink) { +Breadcrumbs::for('admin.airportLinks.edit', function ($trail, $airportLink): void { $trail->parent('admin.airports.show', $airportLink->airport); $trail->push('Edit Airport Link', route('admin.airportLinks.edit', $airportLink)); }); // Home > Admin > Event Links -Breadcrumbs::for('admin.eventLinks.index', function ($trail) { +Breadcrumbs::for('admin.eventLinks.index', function ($trail): void { $trail->parent('admin'); $trail->push('Event Links', route('admin.eventLinks.index')); }); // Home > Admin > Event Links > New -Breadcrumbs::for('admin.eventLinks.create', function ($trail) { +Breadcrumbs::for('admin.eventLinks.create', function ($trail): void { $trail->parent('admin.eventLinks.index'); $trail->push('New', route('admin.eventLinks.create')); }); // Home > Admin > Events > [Event] > [Event Link] > Edit Event Link -Breadcrumbs::for('admin.eventLinks.edit', function ($trail, $eventLink) { +Breadcrumbs::for('admin.eventLinks.edit', function ($trail, $eventLink): void { $trail->parent('admin.events.show', $eventLink->event); $trail->push('Edit Airport Link', route('admin.eventLinks.edit', $eventLink)); }); // Home > Admin > Events -Breadcrumbs::for('admin.events.index', function ($trail) { +Breadcrumbs::for('admin.events.index', function ($trail): void { $trail->parent('admin'); $trail->push('Events', route('admin.events.index')); }); // Home > Admin > Events > [Event] > Edit event -Breadcrumbs::for('admin.events.edit', function ($trail, $event) { +Breadcrumbs::for('admin.events.edit', function ($trail, $event): void { $trail->parent('admin.events.show', $event); $trail->push('Edit Event', route('admin.events.edit', $event)); }); // Home > Admin > Events > New -Breadcrumbs::for('admin.events.create', function ($trail) { +Breadcrumbs::for('admin.events.create', function ($trail): void { $trail->parent('admin.events.index'); $trail->push('New', route('admin.events.create')); }); // Home > Admin > Events > [Event] -Breadcrumbs::for('admin.events.show', function ($trail, $event) { +Breadcrumbs::for('admin.events.show', function ($trail, $event): void { $trail->parent('admin.events.index'); $trail->push($event->name . ' [' . $event->startEvent->toFormattedDateString() . ']', route('admin.events.show', $event)); }); // Home > Admin > Events > [Event] > Send E-mail -Breadcrumbs::for('admin.events.email.form', function ($trail, $event) { +Breadcrumbs::for('admin.events.email.form', function ($trail, $event): void { $trail->parent('admin.events.show', $event); $trail->push('Send E-mail', route('admin.events.email.form', $event)); }); // Home (no event found) -Breadcrumbs::for('bookings.index', function ($trail) { +Breadcrumbs::for('bookings.index', function ($trail): void { $trail->parent('home'); }); // Home > [Event] -Breadcrumbs::for('events.show', function ($trail, $event) { +Breadcrumbs::for('events.show', function ($trail, $event): void { $trail->parent('home'); $trail->push($event->name . ' [' . $event->startEvent->toFormattedDateString() . ']', route('events.show', $event)); }); // Home > [Event] > Bookings -Breadcrumbs::for('bookings.event.index', function ($trail, $event) { +Breadcrumbs::for('bookings.event.index', function ($trail, $event): void { $trail->parent('events.show', $event); $trail->push('Bookings', route('bookings.event.index', $event)); }); // Home > [Event] > Booking -Breadcrumbs::for('bookings.edit', function ($trail, $booking) { +Breadcrumbs::for('bookings.edit', function ($trail, $booking): void { $trail->parent('bookings.event.index', $booking->event); $trail->push('Booking', route('bookings.edit', $booking)); }); // Home > [Event] > My Booking -Breadcrumbs::for('bookings.show', function ($trail, $booking) { +Breadcrumbs::for('bookings.show', function ($trail, $booking): void { $trail->parent('bookings.event.index', $booking->event); $trail->push('My Booking', route('bookings.show', $booking)); }); // Home > Admin > [Event] > Add Slot -Breadcrumbs::for('admin.bookings.create', function ($trail, $event) { +Breadcrumbs::for('admin.bookings.create', function ($trail, $event): void { $trail->parent('admin.events.show', $event); $trail->push('Add Slot(s)', route('admin.bookings.create', $event)); }); // Home > Admin > [Event] > Import -Breadcrumbs::for('admin.bookings.importForm', function ($trail, $event) { +Breadcrumbs::for('admin.bookings.importForm', function ($trail, $event): void { $trail->parent('admin.events.show', $event); $trail->push('Import', route('admin.bookings.importForm', $event)); }); // Home > Admin > [Event] > Booking -Breadcrumbs::for('admin.bookings.edit', function ($trail, $booking) { +Breadcrumbs::for('admin.bookings.edit', function ($trail, $booking): void { $trail->parent('admin.events.show', $booking->event); $trail->push('Edit Booking', route('admin.bookings.edit', $booking)); }); // Home > Admin > [Event] > Auto-Assign FL / Route -Breadcrumbs::for('admin.bookings.autoAssignForm', function ($trail, $event) { +Breadcrumbs::for('admin.bookings.autoAssignForm', function ($trail, $event): void { $trail->parent('admin.events.show', $event); $trail->push('Auto-Assign FL / Route', route('admin.bookings.autoAssignForm', $event)); }); // Home > Admin > [Event] > Route assign -Breadcrumbs::for('admin.bookings.routeAssignForm', function ($trail, $event) { +Breadcrumbs::for('admin.bookings.routeAssignForm', function ($trail, $event): void { $trail->parent('admin.events.show', $event); $trail->push('Route assign', route('admin.bookings.routeAssignForm', $event)); }); // Home > FAQ -Breadcrumbs::for('faq', function ($trail) { +Breadcrumbs::for('faq', function ($trail): void { $trail->parent('home'); $trail->push('FAQ', route('faq')); }); // Home > Admin > FAQ -Breadcrumbs::for('admin.faq.index', function ($trail) { +Breadcrumbs::for('admin.faq.index', function ($trail): void { $trail->parent('admin'); $trail->push('FAQ', route('admin.faq.index')); }); // Home > Admin > FAQ > New -Breadcrumbs::for('admin.faq.create', function ($trail) { +Breadcrumbs::for('admin.faq.create', function ($trail): void { $trail->parent('admin.faq.index'); $trail->push('New', route('admin.faq.create')); }); // Home > Admin > FAQ > [FAQ] -Breadcrumbs::for('admin.faq.show', function ($trail, $faq) { +Breadcrumbs::for('admin.faq.show', function ($trail, $faq): void { $trail->parent('admin.faq.index'); $trail->push('[' . $faq->id . '] ' . $faq->question); }); // Home > Admin > FAQ > [FAQ] > Edit FAQ -Breadcrumbs::for('admin.faq.edit', function ($trail, $faq) { +Breadcrumbs::for('admin.faq.edit', function ($trail, $faq): void { $trail->parent('admin.faq.show', $faq); $trail->push('Edit FAQ', route('admin.faq.edit', $faq)); }); // Home > My settings -Breadcrumbs::for('user.settings', function ($trail) { +Breadcrumbs::for('user.settings', function ($trail): void { $trail->parent('home'); $trail->push('My settings', route('user.settings', auth()->user())); }); diff --git a/routes/channels.php b/routes/channels.php index f16a20b9..076532c4 100644 --- a/routes/channels.php +++ b/routes/channels.php @@ -11,6 +11,4 @@ | */ -Broadcast::channel('App.User.{id}', function ($user, $id) { - return (int) $user->id === (int) $id; -}); +Broadcast::channel('App.User.{id}', fn ($user, $id) => (int) $user->id === (int) $id); diff --git a/routes/console.php b/routes/console.php index 75dd0cde..deb85705 100644 --- a/routes/console.php +++ b/routes/console.php @@ -13,6 +13,6 @@ | */ -Artisan::command('inspire', function () { +Artisan::command('inspire', function (): void { $this->comment(Inspiring::quote()); })->describe('Display an inspiring quote'); diff --git a/routes/web.php b/routes/web.php index 0e3784ed..bc3f462e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -30,7 +30,7 @@ Route::post('/logout', [LoginController::class, 'logout'])->name('logout'); // Admin routes -Route::group(['as' => 'admin.', 'prefix' => 'admin', 'middleware' => 'auth.isAdmin'], function () { +Route::group(['as' => 'admin.', 'prefix' => 'admin', 'middleware' => 'auth.isAdmin'], function (): void { // Airports Route::post('airports/destroy-unused', [AirportAdminController::class, 'destroyUnused'])->name('airports.destroyUnused'); Route::resource('airports', AirportAdminController::class); @@ -89,9 +89,9 @@ Route::get('{event}', EventController::class)->name('events.show'); -Route::middleware('auth.isLoggedIn')->group(function () { +Route::middleware('auth.isLoggedIn')->group(function (): void { Route::prefix('user')->name('user.') - ->group(function () { + ->group(function (): void { Route::get('settings', [UserController::class, 'showSettingsForm'])->name('settings'); Route::patch('settings', [UserController::class, 'saveSettings'])->name('saveSettings'); }); diff --git a/tests/Feature/Console/Commands/ImportAirportsCommandTest.php b/tests/Feature/Console/Commands/ImportAirportsCommandTest.php index 2a1513aa..83843a01 100644 --- a/tests/Feature/Console/Commands/ImportAirportsCommandTest.php +++ b/tests/Feature/Console/Commands/ImportAirportsCommandTest.php @@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Queue; use App\Console\Commands\ImportAirportsCommand; -it('can start airports import', function () { +it('can start airports import', function (): void { /** @var TestCase $this */ Queue::fake(); diff --git a/tests/Feature/Http/Controllers/EventControllerTest.php b/tests/Feature/Http/Controllers/EventControllerTest.php index 12fd9121..0f4e9f1f 100644 --- a/tests/Feature/Http/Controllers/EventControllerTest.php +++ b/tests/Feature/Http/Controllers/EventControllerTest.php @@ -3,7 +3,7 @@ use Tests\TestCase; use App\Models\Event; -it('can render event page', function () { +it('can render event page', function (): void { /** @var TestCase $this */ /** @var Event $event */ diff --git a/tests/Feature/Http/Controllers/FaqControllerTest.php b/tests/Feature/Http/Controllers/FaqControllerTest.php index abbcfed8..f1d06b18 100644 --- a/tests/Feature/Http/Controllers/FaqControllerTest.php +++ b/tests/Feature/Http/Controllers/FaqControllerTest.php @@ -4,7 +4,7 @@ use Tests\TestCase; use App\Models\Event; -it('can render faq page with no items', function () { +it('can render faq page with no items', function (): void { /** @var TestCase $this */ $this->get(route('faq')) ->assertOk() @@ -12,7 +12,7 @@ ->assertSee('No Questions / Answers are available at the moment'); }); -it('can render faq page with generic items', function () { +it('can render faq page with generic items', function (): void { /** @var TestCase $this */ /** @var Faq $faq1 */ @@ -31,7 +31,7 @@ ->assertDontSee($faq2->answer); }); -it('can render faq page with event items', function () { +it('can render faq page with event items', function (): void { /** @var TestCase $this */ /** @var Event $event */ diff --git a/tests/Feature/Http/Controllers/HomeControllerTest.php b/tests/Feature/Http/Controllers/HomeControllerTest.php index b26ad107..3f5b7088 100644 --- a/tests/Feature/Http/Controllers/HomeControllerTest.php +++ b/tests/Feature/Http/Controllers/HomeControllerTest.php @@ -3,13 +3,13 @@ use Tests\TestCase; use App\Models\Event; -it('can render homepage', function () { +it('can render homepage', function (): void { /** @var TestCase $this */ $this->get('/')->assertOk(); }); -it('can render events', function () { +it('can render events', function (): void { /** @var TestCase $this */ /** @var Event $event1 */ diff --git a/tests/Feature/Jobs/EventCleanupReservationsJobTest.php b/tests/Feature/Jobs/EventCleanupReservationsJobTest.php index 7727b447..f669d27c 100644 --- a/tests/Feature/Jobs/EventCleanupReservationsJobTest.php +++ b/tests/Feature/Jobs/EventCleanupReservationsJobTest.php @@ -8,7 +8,7 @@ use App\Models\Event; use Tests\TestCase; -it('cleans up reserverd bookings', function () { +it('cleans up reserverd bookings', function (): void { /** @var TestCase $this */ /** @var Event $event */ diff --git a/tests/Feature/Views/Layout/NavbarTest.php b/tests/Feature/Views/Layout/NavbarTest.php index 6e0b22b7..6f204c3f 100644 --- a/tests/Feature/Views/Layout/NavbarTest.php +++ b/tests/Feature/Views/Layout/NavbarTest.php @@ -5,7 +5,7 @@ use App\Models\User; use App\Models\Event; -it('can render navbar', function () { +it('can render navbar', function (): void { /** @var TestCase $this */ $this->view('layouts.app') @@ -35,7 +35,7 @@ }); -it('can render events', function () { +it('can render events', function (): void { /** @var TestCase $this */ /** @var Event $event1 */ @@ -53,7 +53,7 @@ ->assertDontSee($event3->name); }); -it('can render single booking', function () { +it('can render single booking', function (): void { /** @var TestCase $this */ $booking = Booking::factory()->booked()->create(['user_id' => auth()->id()]); @@ -63,7 +63,7 @@ ->assertSee('My booking'); }); -it('can render multiple bookings', function () { +it('can render multiple bookings', function (): void { /** @var TestCase $this */ $event = Event::factory()->create(); diff --git a/tests/Pest.php b/tests/Pest.php index 951a3e0e..2e20836d 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -26,9 +26,7 @@ | */ -expect()->extend('toBeOne', function () { - return $this->toBe(1); -}); +expect()->extend('toBeOne', fn () => $this->toBe(1)); /* |-------------------------------------------------------------------------- diff --git a/tests/Unit/AirportLinkTest.php b/tests/Unit/AirportLinkTest.php index f5e4f465..862047e2 100644 --- a/tests/Unit/AirportLinkTest.php +++ b/tests/Unit/AirportLinkTest.php @@ -5,7 +5,7 @@ use App\Models\AirportLink; use Tests\TestCase; -it('creates new airport link', function () { +it('creates new airport link', function (): void { /** @var TestCase $this */ /** @var AirportLink $airportLink */ diff --git a/tests/Unit/AirportTest.php b/tests/Unit/AirportTest.php index 7ec8fb29..e4d3361c 100644 --- a/tests/Unit/AirportTest.php +++ b/tests/Unit/AirportTest.php @@ -5,7 +5,7 @@ use App\Models\Airport; use Tests\TestCase; -it('creates new airport', function () { +it('creates new airport', function (): void { /** @var TestCase $this */ /** @var Airport $airport */ diff --git a/tests/Unit/BookingTest.php b/tests/Unit/BookingTest.php index 1b1f2137..bb817f64 100644 --- a/tests/Unit/BookingTest.php +++ b/tests/Unit/BookingTest.php @@ -5,7 +5,7 @@ use App\Models\Flight; use Tests\TestCase; -it('can creates new booking', function () { +it('can creates new booking', function (): void { /** @var TestCase $this */ /** @var Flight $flight */ diff --git a/tests/Unit/EventLinkTest.php b/tests/Unit/EventLinkTest.php index 9ba97643..bbc9f2ca 100644 --- a/tests/Unit/EventLinkTest.php +++ b/tests/Unit/EventLinkTest.php @@ -5,7 +5,7 @@ use App\Models\EventLink; use Tests\TestCase; -it('creates new event link', function () { +it('creates new event link', function (): void { /** @var TestCase $this */ /** @var EventLink $eventLink */ diff --git a/tests/Unit/EventTest.php b/tests/Unit/EventTest.php index 6eb378ef..f5ed63fb 100644 --- a/tests/Unit/EventTest.php +++ b/tests/Unit/EventTest.php @@ -5,7 +5,7 @@ use App\Models\Event; use Tests\TestCase; -it('creates new event', function () { +it('creates new event', function (): void { /** @var TestCase $this */ /** @var Event $event */ diff --git a/tests/Unit/FaqTest.php b/tests/Unit/FaqTest.php index 7ee68eb5..ef4520d3 100644 --- a/tests/Unit/FaqTest.php +++ b/tests/Unit/FaqTest.php @@ -6,7 +6,7 @@ use App\Models\Faq; use Tests\TestCase; -it('creates new FAQ', function () { +it('creates new FAQ', function (): void { /** @var TestCase $this */ /** @var Faq $faq */ @@ -19,7 +19,7 @@ ]); }); -it('links faq to event', function () { +it('links faq to event', function (): void { /** @var TestCase $this */ /** @var Event $event */