File tree Expand file tree Collapse file tree 4 files changed +12
-11
lines changed Expand file tree Collapse file tree 4 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 66
77use BackedEnum ;
88use Filament \Actions \Action ;
9- use Filament \ Facades \ Filament ;
9+ use Relaticle \ CustomFields \ Services \ TenantContextService ;
1010use Filament \Pages \Page ;
1111use Filament \Panel ;
1212use Filament \Support \Enums \Size ;
@@ -136,7 +136,7 @@ public function updateSectionsOrder(array $sections): void
136136 private function storeSection (array $ data ): CustomFieldSection
137137 {
138138 if (FeatureManager::isEnabled (CustomFieldsFeature::SYSTEM_MULTI_TENANCY )) {
139- $ data [config ('custom-fields.database.column_names.tenant_foreign_key ' )] = Filament:: getTenant ()?->getKey ();
139+ $ data [config ('custom-fields.database.column_names.tenant_foreign_key ' )] = TenantContextService:: getCurrentTenantId ();
140140 }
141141
142142 $ data ['type ' ] ??= CustomFieldSectionType::SECTION ->value ;
Original file line number Diff line number Diff line change 55namespace Relaticle \CustomFields \Filament \Management \Schemas ;
66
77use Exception ;
8+ use Relaticle \CustomFields \Services \TenantContextService ;
89use Filament \Forms \Components \ColorPicker ;
910use Filament \Forms \Components \Hidden ;
1011use Filament \Forms \Components \Repeater ;
@@ -84,7 +85,7 @@ public static function schema(bool $withOptionsRelationship = true): array
8485 array $ data
8586 ): array {
8687 if (FeatureManager::isEnabled (CustomFieldsFeature::SYSTEM_MULTI_TENANCY )) {
87- $ data [config ('custom-fields.database.column_names.tenant_foreign_key ' )] = Filament:: getTenant ()?->getKey ();
88+ $ data [config ('custom-fields.database.column_names.tenant_foreign_key ' )] = TenantContextService:: getCurrentTenantId ();
8889 }
8990
9091 return $ data ;
@@ -175,7 +176,7 @@ public static function schema(bool $withOptionsRelationship = true): array
175176 config (
176177 'custom-fields.database.column_names.tenant_foreign_key '
177178 ),
178- Filament:: getTenant ()?->getKey ()
179+ TenantContextService:: getCurrentTenantId ()
179180 )
180181 )
181182 )
@@ -235,7 +236,7 @@ public static function schema(bool $withOptionsRelationship = true): array
235236 config (
236237 'custom-fields.database.column_names.tenant_foreign_key '
237238 ),
238- Filament:: getTenant ()?->getKey ()
239+ TenantContextService:: getCurrentTenantId ()
239240 )
240241 )
241242 )
Original file line number Diff line number Diff line change 44
55namespace Relaticle \CustomFields \Filament \Management \Schemas ;
66
7- use Filament \ Facades \ Filament ;
7+ use Relaticle \ CustomFields \ Services \ TenantContextService ;
88use Filament \Forms \Components \Select ;
99use Filament \Forms \Components \Textarea ;
1010use Filament \Forms \Components \TextInput ;
@@ -55,7 +55,7 @@ public static function schema(): array
5555 config (
5656 'custom-fields.database.column_names.tenant_foreign_key '
5757 ),
58- Filament:: getTenant ()?->getKey ()
58+ TenantContextService:: getCurrentTenantId ()
5959 )
6060 )
6161 ->where ('entity_type ' , self ::$ entityType )
@@ -97,7 +97,7 @@ public static function schema(): array
9797 config (
9898 'custom-fields.database.column_names.tenant_foreign_key '
9999 ),
100- Filament:: getTenant ()?->getKey ()
100+ TenantContextService:: getCurrentTenantId ()
101101 )
102102 )
103103 ->where ('entity_type ' , self ::$ entityType )
Original file line number Diff line number Diff line change 88use Filament \Actions \ActionGroup ;
99use Filament \Actions \Concerns \InteractsWithActions ;
1010use Filament \Actions \Contracts \HasActions ;
11- use Filament \ Facades \ Filament ;
11+ use Relaticle \ CustomFields \ Services \ TenantContextService ;
1212use Filament \Forms \Concerns \InteractsWithForms ;
1313use Filament \Forms \Contracts \HasForms ;
1414use Filament \Support \Enums \Size ;
@@ -167,7 +167,7 @@ public function createFieldAction(): Action
167167 ])
168168 ->mutateDataUsing (function (array $ data ): array {
169169 if (FeatureManager::isEnabled (CustomFieldsFeature::SYSTEM_MULTI_TENANCY )) {
170- $ data [config ('custom-fields.database.column_names.tenant_foreign_key ' )] = Filament:: getTenant ()?->getKey ();
170+ $ data [config ('custom-fields.database.column_names.tenant_foreign_key ' )] = TenantContextService:: getCurrentTenantId ();
171171 }
172172
173173 return [
@@ -181,7 +181,7 @@ public function createFieldAction(): Action
181181 ->filter ()
182182 ->map (function (array $ option ): array {
183183 if (FeatureManager::isEnabled (CustomFieldsFeature::SYSTEM_MULTI_TENANCY )) {
184- $ option [config ('custom-fields.database.column_names.tenant_foreign_key ' )] = Filament:: getTenant ()?->getKey ();
184+ $ option [config ('custom-fields.database.column_names.tenant_foreign_key ' )] = TenantContextService:: getCurrentTenantId ();
185185 }
186186
187187 return $ option ;
You can’t perform that action at this time.
0 commit comments