1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 14:34:04 +00:00
This commit is contained in:
Samuel Štancl 2019-08-17 22:18:42 +02:00
parent 8c74cb4d76
commit 060a4bc525
3 changed files with 26 additions and 13 deletions

View file

@ -3,6 +3,7 @@
namespace Stancl\Tenancy;
use Stancl\Tenancy\Commands\Run;
use Laravel\Telescope\Telescope;
use Stancl\Tenancy\Commands\Seed;
use Illuminate\Cache\CacheManager;
use Stancl\Tenancy\Commands\Install;
@ -43,6 +44,28 @@ class TenancyServiceProvider extends ServiceProvider
]);
$this->app->register(TenantRouteServiceProvider::class);
if (class_exists(Telescope::class)) {
$this->setTelescopeTags();
}
}
public function setTelescopeTags()
{
$original_callback = Telescope::$tagUsing;
Telescope::tag(function (\Laravel\Telescope\IncomingEntry $entry) use ($original_callback) {
$tags = [];
if (! is_null($original_callback)) {
$tags = $original_callback($entry);
}
if (in_array('tenancy', request()->route()->middleware())) {
$tags = array_merge($tags, ['tenant:' . tenant('uuid')]);
}
return $tags;
});
}
/**