From a8f255e5fd196b8a3be47fd239f5b19369d65f09 Mon Sep 17 00:00:00 2001 From: notCharles Date: Sun, 27 Oct 2024 18:00:03 -0400 Subject: [PATCH] add whereNull Add where null to not include allocations already assigned to a server. --- .../RelationManagers/AllocationsRelationManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Filament/Resources/ServerResource/RelationManagers/AllocationsRelationManager.php b/app/Filament/Resources/ServerResource/RelationManagers/AllocationsRelationManager.php index c43132b585..99bc6bb482 100644 --- a/app/Filament/Resources/ServerResource/RelationManagers/AllocationsRelationManager.php +++ b/app/Filament/Resources/ServerResource/RelationManagers/AllocationsRelationManager.php @@ -149,7 +149,7 @@ public function table(Table $table): Table ->multiple() ->associateAnother(false) ->preloadRecordSelect() - ->recordSelectOptionsQuery(fn ($query) => $query->whereBelongsTo($this->getOwnerRecord()->node)) + ->recordSelectOptionsQuery(fn ($query) => $query->whereBelongsTo($this->getOwnerRecord()->node)->whereNull('server_id')) ->label('Add Allocation'), ]) ->bulkActions([