Is your feature request related to a problem? Please describe.
We are using a non-standard folder structure for our app in which the searchable models live in a different namespace to the namespace defined in laravel's Application.php.
Because of this the flush and import commands do not pickup our models since they use the method app()->getNamespace().
Describe the solution you'd like
Either a different method for finding the models or a way to configure the namespace to look in.
Alternatively this could be managed via config. Perhaps with a default value of App\\ or app()->getNamespace().
Describe alternatives you've considered
We can't extend the existing commands so as a workaround we have just copied them as a way of overwriting, then have changed the namespace function call. But this is not ideal as we will need to keep it up to date.
Is your feature request related to a problem? Please describe. We are using a non-standard folder structure for our app in which the searchable models live in a different namespace to the namespace defined in laravel's
Application.php
.Because of this the flush and import commands do not pickup our models since they use the method
app()->getNamespace()
.Describe the solution you'd like Either a different method for finding the models or a way to configure the namespace to look in.
algolia/scout-extended uses an approach which looks at the root
composer.json
file and collects the autoload mappings. Perhaps with some changes to ignore the common database namespaces this would be a good approach. See: https://github.com/algolia/scout-extended/blob/bf3d7876fadaaa1cdbce3a09cfd256227406a3fc/src/Helpers/SearchableFinder.php#L116Alternatively this could be managed via config. Perhaps with a default value of
App\\
orapp()->getNamespace()
.Describe alternatives you've considered We can't extend the existing commands so as a workaround we have just copied them as a way of overwriting, then have changed the namespace function call. But this is not ideal as we will need to keep it up to date.