From 675ff21b6ffb770ac4e4e7921a66e9ad0c2409a4 Mon Sep 17 00:00:00 2001 From: Alec Ritson Date: Wed, 28 Aug 2024 12:42:57 +0100 Subject: [PATCH 1/2] Make association type dynamic --- packages/admin/resources/lang/en/relationmanagers.php | 2 +- .../RelationManagers/CustomerGroupRelationManager.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/admin/resources/lang/en/relationmanagers.php b/packages/admin/resources/lang/en/relationmanagers.php index 15f2b90dd1..9f9223eb93 100644 --- a/packages/admin/resources/lang/en/relationmanagers.php +++ b/packages/admin/resources/lang/en/relationmanagers.php @@ -28,7 +28,7 @@ ], ], 'table' => [ - 'description' => 'Associate customer groups to this product to determine it\'s availability.', + 'description' => 'Associate customer groups to this :type to determine it\'s availability.', 'name' => [ 'label' => 'Name', ], diff --git a/packages/admin/src/Filament/Resources/ProductResource/RelationManagers/CustomerGroupRelationManager.php b/packages/admin/src/Filament/Resources/ProductResource/RelationManagers/CustomerGroupRelationManager.php index 7ca2e66be7..8b58ca9b96 100644 --- a/packages/admin/src/Filament/Resources/ProductResource/RelationManagers/CustomerGroupRelationManager.php +++ b/packages/admin/src/Filament/Resources/ProductResource/RelationManagers/CustomerGroupRelationManager.php @@ -6,6 +6,7 @@ use Filament\Forms\Form; use Filament\Tables; use Filament\Tables\Table; +use Illuminate\Support\Str; use Lunar\Admin\Events\ProductCustomerGroupsUpdated; use Lunar\Admin\Support\RelationManagers\BaseRelationManager; @@ -85,7 +86,9 @@ public function getDefaultTable(Table $table): Table return $table ->description( - $this->description ?: __('lunarpanel::relationmanagers.customer_groups.table.description') + $this->description ?: __('lunarpanel::relationmanagers.customer_groups.table.description', [ + 'type' => Str::lower(class_basename(get_class($this->getOwnerRecord()))) + ]) ) ->paginated(false) ->headerActions([ From 0c5cb13fccedc7bc1fa3a54f8b6218ca21234b37 Mon Sep 17 00:00:00 2001 From: alecritson Date: Wed, 28 Aug 2024 11:45:43 +0000 Subject: [PATCH 2/2] chore: fix code style --- .../RelationManagers/CustomerGroupRelationManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/admin/src/Filament/Resources/ProductResource/RelationManagers/CustomerGroupRelationManager.php b/packages/admin/src/Filament/Resources/ProductResource/RelationManagers/CustomerGroupRelationManager.php index 8b58ca9b96..fdc8232280 100644 --- a/packages/admin/src/Filament/Resources/ProductResource/RelationManagers/CustomerGroupRelationManager.php +++ b/packages/admin/src/Filament/Resources/ProductResource/RelationManagers/CustomerGroupRelationManager.php @@ -87,7 +87,7 @@ public function getDefaultTable(Table $table): Table return $table ->description( $this->description ?: __('lunarpanel::relationmanagers.customer_groups.table.description', [ - 'type' => Str::lower(class_basename(get_class($this->getOwnerRecord()))) + 'type' => Str::lower(class_basename(get_class($this->getOwnerRecord()))), ]) ) ->paginated(false)