Skip to content

Conversation

thewebartisan7
Copy link
Contributor

@thewebartisan7 thewebartisan7 commented Aug 26, 2020

I wanted to generate all code inside a package and this work perfectly fine by just changing path and namespace in configuration of laravel_generator.php

However, the only things that can't be changed is view namespace.

With this change it's possible to add views prefix namespace, so that views are added and load from a package.

In config just add namespace prefix like so:

 'prefixes' => [ 'view' => 'mypackage::admin', ],

Where mypackage is namespace when a new path is added from package using:

$this->loadViewsFrom(__DIR__.'/../resources/views', 'mypackage'); 

There should not be any BC, nor new configuration. Just a simple check if prefixes.view has "::" and if so storing namespace separately from view path.

Then in GeneratorConfig the dynamic variable $VIEW_PREFIX$ is replaced with namespace if set.

The same for ViewGenerator for selectTable fields.

I do test with several commands, but not sure if all cases are covered.

If I discover something else regarding generating code inside package, I will advise.

Of course is important to change also all laravel_generator.path and laravel_generator.namespace in config, especially the path.view.

Thanks for merging !

@thewebartisan7
Copy link
Contributor Author

I have several other changes to handle this, in case you are interested, I can add here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant