Add integration guide for Laravel Scout

This commit is contained in:
lukinovec 2022-08-29 15:09:27 +02:00
parent af05970907
commit 228aad6751
2 changed files with 19 additions and 0 deletions

View file

@ -204,6 +204,7 @@ return [
'Passport' => 'integrations/passport', 'Passport' => 'integrations/passport',
'Nova' => 'integrations/nova', 'Nova' => 'integrations/nova',
'Telescope' => 'integrations/telescope', 'Telescope' => 'integrations/telescope',
'Scout' => 'integrations/scout',
'Livewire' => 'integrations/livewire', 'Livewire' => 'integrations/livewire',
'Orchid' => 'integrations/orchid', 'Orchid' => 'integrations/orchid',
], ],

View file

@ -0,0 +1,18 @@
---
title: Laravel Scout integration
extends: _layouts.documentation
section: content
---
# Laravel Scout {#laravel-scout}
After [installing Scout](https://laravel.com/docs/9.x/scout#installation), make sure the models of all tenants aren't being imported in the same index by prefixing the model indices with the current tenant's key. You can achieve that by adding a listener with this code to the TenancyInitialized event in your TenancyServiceProvider:
```php
config(['scout.prefix' => tenant()->getTenantKey()]);
```
After that, you can import your existing records for each tenant using the `tenants:run` command:
```
php artisan tenants:run scout:import --argument="model=App\Models\YourSearchableModel"
```