mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 11:14:03 +00:00
Move the logic to the middleware
This commit is contained in:
parent
545c2330d4
commit
426d967e38
2 changed files with 14 additions and 14 deletions
|
|
@ -3,6 +3,7 @@
|
|||
namespace Stancl\Tenancy\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Laravel\Telescope\Telescope;
|
||||
|
||||
class InitializeTenancy
|
||||
{
|
||||
|
|
@ -28,6 +29,19 @@ class InitializeTenancy
|
|||
($this->onFail)($e);
|
||||
}
|
||||
|
||||
if (class_exists(Telescope::class)) {
|
||||
$original_callback = Telescope::tagUsing;
|
||||
|
||||
Telescope::tag(function (\Laravel\Telescope\IncomingEntry $entry) use ($original_callback) {
|
||||
$tags = [];
|
||||
if (tenancy()->initialized) {
|
||||
$tags = ['tenant:' . tenant('uuid')];
|
||||
}
|
||||
|
||||
return array_merge($original_callback($entry), $tags);
|
||||
});
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue