mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 18:24:03 +00:00
* Update livewire.blade.md Update livewire integration instructions to refelect ivewire 3 changes. * Update livewire.blade.md * remove unnecessary indentation --------- Co-authored-by: Samuel Štancl <samuel@archte.ch>
49 lines
1.2 KiB
Markdown
49 lines
1.2 KiB
Markdown
---
|
||
title: Livewire integration
|
||
extends: _layouts.documentation
|
||
section: content
|
||
---
|
||
|
||
# Livewire {#livewire}
|
||
|
||
Open the `config/livewire.php` file and change this:
|
||
|
||
```php
|
||
'middleware_group' => ['web'],
|
||
```
|
||
|
||
to this:
|
||
|
||
```php
|
||
'middleware_group' => [
|
||
'web',
|
||
'universal',
|
||
InitializeTenancyByDomain::class, // or whatever tenancy middleware you use
|
||
],
|
||
```
|
||
|
||
In Livewire 3, the configuration key `middleware_group` has been removed, so instead add the following in `TenancyServiceProvider` (or any other provider):
|
||
|
||
```php
|
||
public function boot(): void
|
||
{
|
||
// ...
|
||
|
||
Livewire::setUpdateRoute(function ($handle) {
|
||
return Route::post('/livewire/update', $handle)
|
||
->middleware(
|
||
'web',
|
||
'universal',
|
||
InitializeTenancyByDomain::class, // or whatever tenancy middleware you use
|
||
);
|
||
});
|
||
}
|
||
```
|
||
|
||
(Don't forget to import the middleware class.)
|
||
|
||
Now you can use Livewire both in the central app and the tenant app.
|
||
|
||
Also make sure to enable [universal routes]({{ $page->link('features/universal-routes') }}).
|
||
|
||
And if you're using file uploads, read the [Real-time facades]({{ $page->link('realtime-facades') }}) page of the documentation. Livewire uses real-time facades in the uploading logic.
|