Closed Surt closed 4 years ago
Found it:
vendor/mtolhuys/laravel-schematics/src/Services/ModelMapper.php
on the function map
, line 23 it uses app_path(). Could it be changed to a "config" optional parameter? Setting that to my route works like a charm.
Hi @Surt !
Yeah, I could take this with me in the next release. Just to be clear: do you just want the path to be configurable pointing to another f.e. base_path('foo')
? Or have an array of paths that then need to be combined in the mapping process?
Array of paths please, so it mimics composer's autoload PSR-4 mapping.
I suffer the same issue as OP, that it's only loading in models in the App\ namespace even if I change the model-namespace configuration. - which makes for a rather empty schematic on our setup :cry:
(otherwise, this is a pretty freaking awesome package! kudos)
Thanks @SlyDave!
Working on the array of paths, coming soon!
@Surt @SlyDave
you could try it out in 0.10.0
.
config now:
'model' => [
'namespace' => 'App\\',
'paths' => [
app_path(), \\ Add any path you want the mapper to scan
],
],
Works great! - Thanks :)
'model' => [
'namespace' => 'App\\',
'paths' => [
app_path(),
base_path('MyModels')
],
],
(obviously replace "MyModels" with your models directory; don't call your models folder MyModels ;P)
Yeah! Works great! Thank you!
Hello,
eager to try the package. Actually I have multiple namespaces and can't make
schematics
to read them. I need to set the config for each individual package. Since some packages make use of others I can't make them appear on the interface.Can I trick
schematics
to scaffold a "base" namespace, so it finds the "models" in there?Edited: The config only affects new models forms etc... the scaffolding is not working right now.
I'm using https://github.com/nWidart/laravel-modules, nothing fancy, just a way to divide the code into components, 100% laravel way. But still...