1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 03:54:04 +00:00
This commit is contained in:
Samuel Štancl 2019-08-02 20:09:22 +02:00
parent f23fd125b1
commit 496b8a3ff0

View file

@ -2,9 +2,10 @@
namespace Stancl\Tenancy; namespace Stancl\Tenancy;
use Stancl\Tenancy\Commands\Seed;
use Laravel\Telescope\Telescope; use Laravel\Telescope\Telescope;
use Stancl\Tenancy\TenantManager; use Stancl\Tenancy\TenantManager;
use Stancl\Tenancy\Commands\Seed;
use Illuminate\Cache\CacheManager;
use Stancl\Tenancy\DatabaseManager; use Stancl\Tenancy\DatabaseManager;
use Stancl\Tenancy\Commands\Migrate; use Stancl\Tenancy\Commands\Migrate;
use Stancl\Tenancy\Commands\Rollback; use Stancl\Tenancy\Commands\Rollback;
@ -13,7 +14,6 @@ use Illuminate\Support\ServiceProvider;
use Stancl\Tenancy\Commands\TenantList; use Stancl\Tenancy\Commands\TenantList;
use Stancl\Tenancy\Interfaces\StorageDriver; use Stancl\Tenancy\Interfaces\StorageDriver;
use Stancl\Tenancy\Interfaces\ServerConfigManager; use Stancl\Tenancy\Interfaces\ServerConfigManager;
use Illuminate\Cache\CacheManager;
class TenancyServiceProvider extends ServiceProvider class TenancyServiceProvider extends ServiceProvider
{ {
@ -40,18 +40,18 @@ class TenancyServiceProvider extends ServiceProvider
$this->loadRoutesFrom(__DIR__ . '/routes.php'); $this->loadRoutesFrom(__DIR__ . '/routes.php');
Route::middlewareGroup('tenancy', [ Route::middlewareGroup('tenancy', [
\Stancl\Tenancy\Middleware\InitializeTenancy::class \Stancl\Tenancy\Middleware\InitializeTenancy::class,
]); ]);
$this->app->register(TenantRouteServiceProvider::class); $this->app->register(TenantRouteServiceProvider::class);
if (class_exists(Telescope::class)) { if (class_exists(Telescope::class)) {
$original_callback = Telescope::tagUsing; $original_callback = Telescope::tagUsing;
Telescope::tag(function (\Laravel\Telescope\IncomingEntry $entry) use ($original_callback) { Telescope::tag(function (\Laravel\Telescope\IncomingEntry $entry) use ($original_callback) {
$tags = []; $tags = [];
if (tenancy()->initialized) { if (tenancy()->initialized) {
$tags = ['tenant:'.tenanct('uuid')]; $tags = ['tenant:' . tenant('uuid')];
} }
return array_merge($original_callback($entry), $tags); return array_merge($original_callback($entry), $tags);