tenancy-docs/source/docs/v3/integrations/livewire.blade.md
Shahin a8fdadf3e5
Update livewire.blade.md
Update livewire integration instructions to refelect ivewire 3 changes.
2023-09-13 12:57:39 +03:00

1.3 KiB

title extends section
Livewire integration _layouts.documentation content

Livewire

Open the config/livewire.php file and change this:

'middleware_group' => ['web'],

to this:

'middleware_group' => [
    'web',
    'universal',
    InitializeTenancyByDomain::class, // or whatever tenancy middleware you use
],

For livewire 3, configuration key middleware_group has been removed, so instead in the AppServiceProvider.php add the following:

public function boot(): void
    {
        ...

        Livewire::setUpdateRoute(static 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.