You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use kernel identification, add InitializeTenancyByPath or InitializeTenancyByRequestData to $middleware in your App/Http/Kernel.php. To use route-level identification, apply the middleware directly to the route – with route-level path identification, you also need to re-register the routes.
Livewire
- v2 – In the livewire.php config file (if you don't have it, publish it using php artisan livewire:publish --config), change the value of 'middleware' to ['universal', 'web'].
- v3 – update the Livewire update route so that it's universal
Use UrlBindingBootstrapper in your tenancy.php config. The bootstrapper swaps the current 'url' (UrlGenerator) instance for our TenancyUrlGenerator.
a) Path Identification
Set TenancyUrlGenerator's $prefixRouteNames property to true.
// E.g. in TenancyServiceProvider's boot()TenancyUrlGenerator::$prefixRouteNames = true;
Make sure you re-register routes (including the LW routes) in your TenancyServiceProvider's boot() method.
Livewire v2
Assign ['universal', 'web'] (or ['universal', 'web', IdentificationMW::class] if you want route-level identification) to the'middleware_group'LW config key (in livewire.php).
Call the following code in your TenancyServiceProvider's boot() method:
Note: Don't forget to also re-register the routes when using route-level path identification with package routes
To make file uploads work, follow the real-time facades docs page to create framework directories.
The text was updated successfully, but these errors were encountered:
lukinovec
changed the title
[4.x] Livewire integration with path or request data identification
[4.x] Livewire integration with path/request data identification
Jun 2, 2023
To use kernel identification, add InitializeTenancyByPath or InitializeTenancyByRequestData to $middleware in your App/Http/Kernel.php. To use route-level identification, apply the middleware directly to the route – with route-level path identification, you also need to re-register the routes.
Livewire
- v2 – In the livewire.php config file (if you don't have it, publish it using
php artisan livewire:publish --config
), change the value of 'middleware' to['universal', 'web']
.- v3 – update the Livewire update route so that it's universal
Use UrlBindingBootstrapper in your tenancy.php config. The bootstrapper swaps the current 'url' (UrlGenerator) instance for our TenancyUrlGenerator.
a) Path Identification
Set TenancyUrlGenerator's
$prefixRouteNames
property totrue
.Make sure you re-register routes (including the LW routes) in your TenancyServiceProvider's
boot()
method.Livewire v2
Assign
['universal', 'web']
(or['universal', 'web', IdentificationMW::class]
if you want route-level identification) to the'middleware_group'
LW config key (in livewire.php).Call the following code in your TenancyServiceProvider's
boot()
method:Also, update the app URL in your layout's script like this:
Livewire v3
Call the following code in your TenancyServiceProvider's
boot()
method:b) Request data identification
Make sure the TenancyUrlGenerator's $prefixRouteNames property is
false
.Livewire v2
Add the tenant header to the global
window.Livewire.connection.headers
JS property in your layout view, e.g.:Livewire v3
Call the following code in your TenancyServiceProvider's boot() method:
Add the tenant header in your layout view like this:
To make file uploads work, follow the real-time facades docs page to create framework directories.
The text was updated successfully, but these errors were encountered: