1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 20:34:03 +00:00

Telescope v3 tags

This commit is contained in:
Samuel Štancl 2020-06-14 14:18:49 +02:00
parent 5f5d5aa5ad
commit ebec926410
2 changed files with 3 additions and 18 deletions

View file

@ -23,9 +23,6 @@ class QueueTenancyBootstrapper implements TenancyBootstrapper
/** @var QueueManager */
protected $queue;
/** @var Dispatcher */
protected $event;
/**
* The normal constructor is only executed after tenancy is bootstrapped.
* However, we're registering a hook to initialize tenancy. Therefore,

View file

@ -11,9 +11,6 @@ use Stancl\Tenancy\Tenancy;
class TelescopeTags implements Feature
{
/** @var callable User-specific callback that returns tags. */
public static $getTagsUsing;
public function bootstrap(Tenancy $tenancy): void
{
if (! class_exists(Telescope::class)) {
@ -21,28 +18,19 @@ class TelescopeTags implements Feature
}
Telescope::tag(function (IncomingEntry $entry) {
$tags = $this->getTags($entry);
$tags = [];
if (! request()->route()) {
return $tags;
}
if (tenancy()->initialized) {
$tags = array_merge($tags, [
$tags = [
'tenant:' . tenant('id'),
]);
];
}
return $tags;
});
}
public static function getTags(IncomingEntry $entry): array
{
$callback = static::$getTagsUsing ?? function () {
return [];
};
return $callback($entry);
}
}