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

Modular App Package #371

Closed
arieltoledo opened this issue Jan 11, 2017 · 5 comments · May be fixed by #691
Closed

Modular App Package #371

arieltoledo opened this issue Jan 11, 2017 · 5 comments · May be fixed by #691

Comments

@arieltoledo
Copy link

Hi, I wonder if the generator will work with [(https://github.com/nWidart/laravel-modules.)]

@illuminate3
Copy link

I am currently working towards this.

Game plan:

  1. build all files in a regular laravel app setup
  2. redo all namespaces to file nWidart's module by hand

I do not think that this package will do that for you automatically ... however, please note that I have not tried changing any default settings in the config files. But still ... doing a search and replace in sublime is very easy.

@arieltoledo
Copy link
Author

@illuminate3 ll,be nice if you write a small tutorial on this.

@illuminate3
Copy link

HI,

I have finally had a chance to play around with my idea. I am not using the module package right now but you can change the config file for the generator.

'controller' => app_path('Http/Controllers/User/'),

I added the "User" to the end and then ran everything. I would think that to do this for a module you would have to create the module first and then change the config file to point to the all the directories in the module.

I haven't had a chance to move routes around but I'm thinking it should be really easy to do.

@shemgp
Copy link
Contributor

shemgp commented Feb 8, 2018

Using melihovv/laravel-package-generator and changing laravel_generate.php to bellow enables generation of CRUD inside packages:

<?php
$package_path = 'packages/shemgp/rbac_manager/src/';
$package_namespace = 'shemgp\\rbac_manager\\';
return [

    /*
    |--------------------------------------------------------------------------
    | Paths
    |--------------------------------------------------------------------------
    |
    */

    'path' => [

        'migration'         => base_path($package_path.'database/migrations/'),

        'model'             => base_path($package_path.'app/Models/'),

        'datatables'        => base_path($package_path.'app/DataTables/'),

        'repository'        => base_path($package_path.'app/Repositories/'),

        'routes'            => base_path($package_path.'routes/web.php'),

        'api_routes'        => base_path($package_path.'routes/api.php'),

        'request'           => base_path($package_path.'app/Http/Requests/'),

        'api_request'       => base_path($package_path.'app/Http/Requests/API/'),

        'controller'        => base_path($package_path.'app/Http/Controllers/'),

        'api_controller'    => base_path($package_path.'app/Http/Controllers/API/'),

        'test_trait'        => base_path($package_path.'tests/traits/'),

        'repository_test'   => base_path($package_path.'tests/'),

        'api_test'          => base_path($package_path.'tests/'),

        'views'             => base_path($package_path.'resources/views/'),

        'schema_files'      => base_path($package_path.'resources/model_schemas/'),

        'templates_dir'     => base_path($package_path.'resources/infyom/infyom-generator-templates/'),

        'modelJs'           => base_path($package_path.'resources/assets/js/models/'),
    ],

    /*
    |--------------------------------------------------------------------------
    | Namespaces
    |--------------------------------------------------------------------------
    |
    */

    'namespace' => [

        'model'             => $package_namespace.'App\Models',

        'datatables'        => $package_namespace.'App\DataTables',

        'repository'        => $package_namespace.'App\Repositories',

        'controller'        => $package_namespace.'App\Http\Controllers',

        'api_controller'    => $package_namespace.'App\Http\Controllers\API',

        'request'           => $package_namespace.'App\Http\Requests',

        'api_request'       => $package_namespace.'App\Http\Requests\API',
    ],

    /*
    |--------------------------------------------------------------------------
    | Templates
    |--------------------------------------------------------------------------
    |
    */

    'templates'         => 'adminlte-templates',

    'default_layout'    => 'back-project::layouts.admin',

    /*
    |--------------------------------------------------------------------------
    | Model extend class
    |--------------------------------------------------------------------------
    |
    */

    'model_extend_class' => env('ENABLE_USER_TRACKING_MODEL') == 'true' ? 'InfyOm\Generator\Model\UserTrackingBaseModel' : 'Eloquent',

    /*
    |--------------------------------------------------------------------------
    | API routes prefix & version
    |--------------------------------------------------------------------------
    |
    */

    'api_prefix'  => 'api',

    'api_version' => 'v1',

    /*
    |--------------------------------------------------------------------------
    | Options
    |--------------------------------------------------------------------------
    |
    */

    'options' => [

        'softDelete' => true,

        'tables_searchable_default' => false,

        'hidden_fields' => env('ENABLE_USER_TRACKING_MODEL') == 'true' ? [
            'user_id'
        ] : [],

        'excluded_fields' => [
            'created_at',
            'updated_at',
            'deleted_at',
            'id'
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Prefixes
    |--------------------------------------------------------------------------
    |
    */

    'prefixes' => [

        'route' => '',  // using admin will create route('admin.?.index') type routes

        'path' => '',

        'view' => '',  // using backend will create return view('backend.?.index') type the backend views directory

        'public' => '',
    ],

    /*
    |--------------------------------------------------------------------------
    | Add-Ons
    |--------------------------------------------------------------------------
    |
    */

    'add_on' => [

        'swagger'       => false,

        'tests'         => true,

        'datatables'    => false,

        'menu'          => [

            'enabled'       => true,

            'menu_file'     => 'layouts/menu.blade.php',
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Timestamp Fields
    |--------------------------------------------------------------------------
    |
    */

    'timestamps' => [

        'enabled'       => true,

        'created_at'    => 'created_at',

        'updated_at'    => 'updated_at',

        'deleted_at'    => 'deleted_at',
    ],

    /*
    |--------------------------------------------------------------------------
    | Save model files to `App/Models` when use `--prefix`. see #208
    |--------------------------------------------------------------------------
    |
    */
    'ignore_model_prefix' => false,

];

@karneaud
Copy link

@mitulgolakiya @illuminate3 @arieltoledo @shemgp seems this guy may have a solutions https://github.com/dsielab/generator-module

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

Successfully merging a pull request may close this issue.

5 participants