diff --git a/assets/config.php b/assets/config.php index fec50a75..11eee8df 100644 --- a/assets/config.php +++ b/assets/config.php @@ -161,6 +161,7 @@ return [ */ 'features' => [ // Stancl\Tenancy\Features\UserImpersonation::class, + // Stancl\Tenancy\Features\TelescopeTags::class, // Stancl\Tenancy\Features\TenantConfig::class, // https://tenancy.samuelstancl.me/docs/v2/features/tenant-config/ // Stancl\Tenancy\Features\CrossDomainRedirect::class, // https://tenancy.samuelstancl.me/docs/v2/features/tenant-redirect/ ], diff --git a/src/Features/TelescopeTags.php b/src/Features/TelescopeTags.php new file mode 100644 index 00000000..78dd51ec --- /dev/null +++ b/src/Features/TelescopeTags.php @@ -0,0 +1,48 @@ +getTags($entry); + + if (! request()->route()) { + return $tags; + } + + if (tenancy()->initialized) { + $tags = array_merge($tags, [ + 'tenant:' . tenant('id'), + ]); + } + + return $tags; + }); + } + + public static function getTags(IncomingEntry $entry): array + { + $callback = static::$getTagsUsing ?? function () { + return []; + }; + + return $callback($entry); + } +} \ No newline at end of file