mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 11:44:04 +00:00
wip
This commit is contained in:
parent
d0d1f6930b
commit
f7bbf59f0c
3 changed files with 30 additions and 1 deletions
|
|
@ -19,7 +19,8 @@
|
||||||
"psy/psysh": "@stable",
|
"psy/psysh": "@stable",
|
||||||
"laravel/framework": "5.8.*||5.7.*",
|
"laravel/framework": "5.8.*||5.7.*",
|
||||||
"orchestra/testbench": "~3.7||~3.8",
|
"orchestra/testbench": "~3.7||~3.8",
|
||||||
"league/flysystem-aws-s3-v3": "~1.0"
|
"league/flysystem-aws-s3-v3": "~1.0",
|
||||||
|
"laravel/telescope": "^2.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Stancl\Tenancy;
|
namespace Stancl\Tenancy;
|
||||||
|
|
||||||
use Stancl\Tenancy\Commands\Seed;
|
use Stancl\Tenancy\Commands\Seed;
|
||||||
|
use Laravel\Telescope\Telescope;
|
||||||
use Stancl\Tenancy\TenantManager;
|
use Stancl\Tenancy\TenantManager;
|
||||||
use Stancl\Tenancy\DatabaseManager;
|
use Stancl\Tenancy\DatabaseManager;
|
||||||
use Stancl\Tenancy\Commands\Migrate;
|
use Stancl\Tenancy\Commands\Migrate;
|
||||||
|
|
@ -42,6 +43,19 @@ class TenancyServiceProvider extends ServiceProvider
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->app->register(TenantRouteServiceProvider::class);
|
$this->app->register(TenantRouteServiceProvider::class);
|
||||||
|
|
||||||
|
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:'.tenanct('uuid')];
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_merge($original_callback($entry), $tags);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
14
tests/TelescopeTest.php
Normal file
14
tests/TelescopeTest.php
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Stancl\Tenancy\Tests;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
|
||||||
|
class CacheManagerTest extends TestCase
|
||||||
|
{
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
Artisan::call('telescope:install');
|
||||||
|
Artisan::call('migrate');
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue