[4.x] Add integration guide for Laravel Scout#193
Conversation
|
The page looks great. A few notes:
|
It should work, Scout gets the index name via the
Right. I added that to the page.
I wrote the bootstrapper: class ScoutTenancyBootstrapper implements TenancyBootstrapper
{
/** @var Repository */
protected $config;
public function __construct(Repository $config)
{
$this->config = $config;
}
public function bootstrap(Tenant $tenant)
{
$this->config->set('scout.prefix', $tenant->getTenantKey());
}
public function revert()
{
$this->config->set('scout.prefix', '');
}
} |
Can you link to the code? |
|
|
I see, and that gets invoked every time, right? The value isn't cached anywhere like I mentioned it could be. |
|
Also, looking at the bootstrapper I'm thinking that we could make this a first-party feature rather than something in the docs? I'd make a few adjustments to the bootstrapper to make it more complete for production. But it could be part of our package directly. |
Yeah, that seems to be right. I can't find the value cached anywhere
I thought about this because the only first-party bootstrappers are for the "core" things (the filesystem, database, etc. – things you need in most apps), so providing a bootstrapper for Scout seemed odd to me. Having the first-party bootstrapper could be helpful, but I think providing the instructions so the user can create it seems better. |
|
We have a class that adds Telescope support but it's a feature, not a bootstrapper. The type doesn't matter much though. I agree that we should somehow keep the repo/namespace clean. Perhaps we could add a folder, like |
|
In the SaaS boilerplate we're using a bootstrapper for Nova: https://github.com/tenancy-for-laravel/saas-boilerplate/blob/master/app/TenancyBootstrappers/NovaAuthGuardBootstrapper.php |
That sounds good |
|
Can you try to open a PR to the Tenancy repo adding this class? Into the I wanted to work on this myself, since I wanted to make some changes, but you might be able to do that on your own. Simply: add a property whose value gets set in And you can inject the |
Opened the PR archtechx/tenancy#936 |
|
@stancl, I've updated the guide |
|
The guide now includes v4 syntax, right? So the PR should be changed to a draft and merged when we write v4 docs? |
I see, yeah, the bootstrapper is a v4 thing, so I'm changing this to draft now |
In response to #72, I'm adding a short integration guide for Laravel Scout.