mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 13:14:05 +00:00
Merge branch 'master' of github.com:archtechx/tenancy into add-postgres-rls-support
This commit is contained in:
commit
eec993151e
28 changed files with 605 additions and 38 deletions
|
|
@ -4,14 +4,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Stancl\Tenancy\Jobs;
|
||||
use Stancl\Tenancy\Events;
|
||||
use Stancl\Tenancy\Listeners;
|
||||
use Stancl\Tenancy\Middleware;
|
||||
use Stancl\JobPipeline\JobPipeline;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Stancl\JobPipeline\JobPipeline;
|
||||
use Stancl\Tenancy\Events;
|
||||
use Stancl\Tenancy\Jobs;
|
||||
use Stancl\Tenancy\Listeners;
|
||||
use Stancl\Tenancy\Middleware;
|
||||
|
||||
class TenancyServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -120,6 +120,21 @@ class TenancyServiceProvider extends ServiceProvider
|
|||
];
|
||||
}
|
||||
|
||||
protected function overrideUrlInTenantContext(): void
|
||||
{
|
||||
/**
|
||||
* Example of CLI tenant URL root override:
|
||||
*
|
||||
* UrlTenancyBootstrapper::$rootUrlOverride = function (Tenant $tenant) {
|
||||
* $baseUrl = env('APP_URL');
|
||||
* $scheme = str($baseUrl)->before('://');
|
||||
* $hostname = str($baseUrl)->after($scheme . '://');
|
||||
*
|
||||
* return $scheme . '://' . $tenant->getTenantKey() . '.' . $hostname;
|
||||
* };
|
||||
*/
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
|
|
@ -131,6 +146,7 @@ class TenancyServiceProvider extends ServiceProvider
|
|||
$this->mapRoutes();
|
||||
|
||||
$this->makeTenancyMiddlewareHighestPriority();
|
||||
$this->overrideUrlInTenantContext();
|
||||
}
|
||||
|
||||
protected function bootEvents()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue