Skip to content

Modular App Package #371

@arieltoledo

Description

@arieltoledo

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

Activity

illuminate3

illuminate3 commented on May 31, 2017

@illuminate3

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

arieltoledo commented on May 31, 2017

@arieltoledo
Author

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

illuminate3

illuminate3 commented on Jun 8, 2017

@illuminate3

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

shemgp commented on Feb 8, 2018

@shemgp
Contributor

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

karneaud commented on May 19, 2019

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @shemgp@mitulgolakiya@karneaud@arieltoledo@illuminate3

      Issue actions

        Modular App Package · Issue #371 · InfyOmLabs/laravel-generator