1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 10:14:04 +00:00

Move URL overriding to a separate method, call it in boot()

This commit is contained in:
lukinovec 2023-01-17 13:28:56 +01:00
parent d133560edd
commit ee5d5b4c12

View file

@ -4,14 +4,17 @@ declare(strict_types=1);
namespace App\Providers; namespace App\Providers;
use Stancl\Tenancy\Jobs;
use Stancl\Tenancy\Events;
use Stancl\Tenancy\Listeners;
use Stancl\Tenancy\Middleware;
use Illuminate\Support\Facades\URL;
use Stancl\JobPipeline\JobPipeline;
use Stancl\Tenancy\Contracts\Tenant;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Stancl\JobPipeline\JobPipeline; use Stancl\Tenancy\Bootstrappers\UrlTenancyBootstrapper;
use Stancl\Tenancy\Events;
use Stancl\Tenancy\Jobs;
use Stancl\Tenancy\Listeners;
use Stancl\Tenancy\Middleware;
class TenancyServiceProvider extends ServiceProvider class TenancyServiceProvider extends ServiceProvider
{ {
@ -116,7 +119,7 @@ class TenancyServiceProvider extends ServiceProvider
]; ];
} }
public function register() protected function overrideUrlInTenantContext(): void
{ {
/** /**
* Example of CLI tenant URL root override: * Example of CLI tenant URL root override:
@ -132,6 +135,12 @@ class TenancyServiceProvider extends ServiceProvider
* ->toString(); * ->toString();
*}; *};
*/ */
}
public function register()
{
//
} }
public function boot() public function boot()
@ -140,6 +149,7 @@ class TenancyServiceProvider extends ServiceProvider
$this->mapRoutes(); $this->mapRoutes();
$this->makeTenancyMiddlewareHighestPriority(); $this->makeTenancyMiddlewareHighestPriority();
$this->overrideUrlInTenantContext();
} }
protected function bootEvents() protected function bootEvents()