From d659bf43491b6e0d801925d8765cbf336f796630 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Thu, 18 Apr 2024 03:50:33 -0400 Subject: [PATCH] Allow primary allocation to be changed --- app/Filament/Resources/ServerResource.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Filament/Resources/ServerResource.php b/app/Filament/Resources/ServerResource.php index 452ae1be8..8f769ff2c 100644 --- a/app/Filament/Resources/ServerResource.php +++ b/app/Filament/Resources/ServerResource.php @@ -523,9 +523,11 @@ class ServerResource extends Resource ->label('Owner') ->url(fn (Server $server): string => route('filament.admin.resources.users.edit', ['record' => $server->user])) ->sortable(), - Tables\Columns\SelectColumn::make('allocation.id') + Tables\Columns\SelectColumn::make('allocation_id') ->label('Primary Allocation') - ->options(fn ($state, Server $server) => [$server->allocation->id => $server->allocation->address]) + ->options(fn ($state, Server $server) => $server->allocations->mapWithKeys( + fn ($allocation) => [$allocation->id => $allocation->address]) + ) ->selectablePlaceholder(false) ->sortable(), Tables\Columns\TextColumn::make('image')->hidden(),