Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow add namespace to views #892

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant