diff --git a/navigation.php b/navigation.php index 65c3caf..06d2a97 100644 --- a/navigation.php +++ b/navigation.php @@ -204,6 +204,7 @@ return [ 'Passport' => 'integrations/passport', 'Nova' => 'integrations/nova', 'Telescope' => 'integrations/telescope', + 'Scout' => 'integrations/scout', 'Livewire' => 'integrations/livewire', 'Orchid' => 'integrations/orchid', ], diff --git a/source/docs/v3/integrations/scout.blade.md b/source/docs/v3/integrations/scout.blade.md new file mode 100644 index 0000000..c9f7b48 --- /dev/null +++ b/source/docs/v3/integrations/scout.blade.md @@ -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" +```