mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 09:54:03 +00:00
Telescope v3 tags
This commit is contained in:
parent
5f5d5aa5ad
commit
ebec926410
2 changed files with 3 additions and 18 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue