mycmdev / nova-modules

A Laravel Nova Tool helping modularize your application
MIT License
7 stars 6 forks source link

Feature: customize namespaces and paths #3

Open 4n70w4 opened 4 years ago

4n70w4 commented 4 years ago

Hi! I already use nwidart/laravel-modules for generate modules and I want to put nova classes in the same modules.

Current structure:

But directories and namespaces is hardcoded in your package =(

For example:

Hardoded path for Resources https://github.com/mycmdev/nova-modules/blob/779a600fe5d9240523792347305275ca72adc3a7/src/Commands/MakeResourceCommand.php#L73

Hardcoded namespace for Resources https://github.com/mycmdev/nova-modules/blob/779a600fe5d9240523792347305275ca72adc3a7/src/Stubs/Resource.stub#L3

In nwidart/laravel-modules pathes and namespaces not hardcoded and generated dinamically:

$path = GenerateConfigReader::read('factory')->getPath();
$namespace = GenerateConfigReader::read('factory')->getNamespace();

This way is better and more convenient.

For example I add to nwidart/laravel-modules config file config/modules.php:102 paths / generator section for generate Nova directories:

            'actions' => ['path' => 'Nova/Actions', 'generate' => true],
            'cards' => ['path' => 'Nova/Cards', 'generate' => true],
            'dashboards' => ['path' => 'Nova/Dashboards', 'generate' => true],
            'filters' => ['path' => 'Nova/Filters', 'generate' => true],
            'lenses' => ['path' => 'Nova/Lenses', 'generate' => true],
            'metrics' => ['path' => 'Nova/Metrics', 'generate' => true],
            'resources' => ['path' => 'Nova/Resources', 'generate' => true],
mycmdev commented 4 years ago

Hello, i know, but the package is still under developing.. i will add this to my TODO. Thx for reporting this issue