mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 02:04:03 +00:00
Update integrations/livewire.blade.md
I made some minor changes to @FelipeVeiga proposal and added them to the documentation. https://github.com/archtechx/tenancy/issues/628#issuecomment-1161863700
This commit is contained in:
parent
ca2ee41ab4
commit
4489c4f08e
1 changed files with 48 additions and 0 deletions
|
|
@ -6,6 +6,8 @@ section: content
|
|||
|
||||
# Livewire {#livewire}
|
||||
|
||||
## Tenancy by domain
|
||||
|
||||
Open the `config/livewire.php` file and change this:
|
||||
|
||||
```php
|
||||
|
|
@ -29,3 +31,49 @@ 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.
|
||||
|
||||
## Tenancy by path
|
||||
|
||||
Open the `config/livewire.php` file and change this:
|
||||
|
||||
```php
|
||||
'middleware_group' => ['web'],
|
||||
```
|
||||
|
||||
to this:
|
||||
|
||||
```php
|
||||
'middleware_group' => [
|
||||
'web',
|
||||
InitializeTenancyByPath::class,
|
||||
],
|
||||
```
|
||||
|
||||
(Don't forget to import the middleware class.)
|
||||
|
||||
Open the `config/livewire.php` file and add this:
|
||||
|
||||
```php
|
||||
use Livewire\Controllers\HttpConnectionHandler;
|
||||
|
||||
Route::group([
|
||||
'prefix' => '/{tenant}',
|
||||
'middleware' => [
|
||||
'web',
|
||||
InitializeTenancyByPath::class,
|
||||
],
|
||||
], function () {
|
||||
Route::post('livewire/message/{name}', [HttpConnectionHandler::class, '__invoke']);
|
||||
});
|
||||
```
|
||||
|
||||
Finally, open the blade file where the `@livewireScripts` directive is, and add:
|
||||
|
||||
```html
|
||||
@livewireScripts
|
||||
<script>
|
||||
window.livewire_app_url = '{{ tenant()->id }}';
|
||||
</script>
|
||||
```
|
||||
|
||||
Now you can use Livewire both in the central app and the tenant app.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue