1
0
Fork 0
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:
lukinovec 2023-04-21 10:59:38 +02:00
commit eec993151e
28 changed files with 605 additions and 38 deletions

View file

@ -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()