Livewire 3 file uploads

This commit is contained in:
Samuel Štancl 2024-02-15 11:38:45 +01:00 committed by GitHub
parent f376bf88e5
commit d6233d0df2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,7 +40,19 @@ public function boot(): void
}
```
(Don't forget to import the middleware class.)
To make file uploads work on Livewire 3, set the following in any service provider:
```php
// specify the right identification middleware
FilePreviewController::$middleware = ['web', 'universal', InitializeTenancyByDomain::class];
```
And change `livewire.temporary_file_upload.middleware` to include the tenancy middleware as well:
```php
// config/livewire.php
'livewire.temporary_file_upload.middleware' => ['throttle:60,1', 'universal', InitializeTenancyByDomain::class],
```
Now you can use Livewire both in the central app and the tenant app.