Skip to content

jackpit93/laravel-entity-scaffold

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Enter your entity and I make anything for your entity

This package will help you to create a model,migration,controller,request,resource just by writing the name.

⬇️ Installation

You can install the package via composer:

composer require mohammad-najjary/laravel-entity-scaffold

The default paths are set in config/entity-scaffold.php. Publish the config to copy the file to your own config:

php artisan vendor:publish  --tag="entity-scaffold"

🤔 How to Use?

php artisan make:entity your_entity

Suppose our entity is a product:

php artisan make:entity product

after that,it make file in this paths:

Models:

App/Models/Product/Product.php

Controllers:

App/Http/Controllers/ProductsController.php

Form Requests:

App/Requests/Product/StoreProduct.php

Resources:

App/Resources/Product/ProductsResource.php
App/Resources/Product/ProductsCollection.php

Migrations:

****_**_**_******_create_products_table

⚙️Options

By entering the command below see options list:

php artisan make:entity --help

output:

Description:
  Create (model,migration,controller,request,resource) for your entity.

Usage:
  make:entity [options] [--] <entity>

Arguments:
  entity                Name of the entity

Options:
      --con             Ignore making the controller
      --mod             Ignore making the model
      --mig             Ignore making the migration
      --res             Ignore making the resource
      --req             Ignore making the request
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

how to ignore make Model,controller, etc?

All you have to do is use the first three letters of each class,eg:

I ignore migration for order entity

$ php artisan make:entity order --mig
--- Controller created  successfully
--- Model created  successfully
 -  -  - Ignore making the migration
--- Request created  successfully
--- Resource created  successfully

Now i ignore all except migration

$ php artisan make:entity dart --req --res --con --mod  
 -  -  - Ignore making the controller
 -  -  - Ignore making the model
--- Migration created  successfully
 -  -  - Ignore making the request
 -  -  - Ignore making the resource

⚙️ change default paths

If you change default path.first see config/entity-scaffold.php file:

<?php
return [


    /*
    |--------------------------------------------------------------------------
    | Controllers Path
    |--------------------------------------------------------------------------
    |
    | Your controller path is located here App/Http/Controllers/{ENTITY_SCAFFOLD_CONTROLLER_PATH}
    | example:
    | ENTITY_SCAFFOLD_CONTROLLER_PATH='Admin/'
    | Don't forget insert "/" to end of Your path.
    */
    'controllers_path' => env('ENTITY_SCAFFOLD_CONTROLLER_PATH', '/'),


    /*
    |--------------------------------------------------------------------------
    | Models Path
    |--------------------------------------------------------------------------
    |
    | Your Models Path is located here App/{ENTITY_SCAFFOLD_MODEL_PATH}
    |
    */
    'models_path' => env('ENTITY_SCAFFOLD_MODEL_PATH', 'Models/'),


    /*
    |--------------------------------------------------------------------------
    | Resource Path
    |--------------------------------------------------------------------------
    |
    | Your Resource Path is located here App/Http/Resources/{ENTITY_SCAFFOLD_RESOURCE_PATH}
    |
    */
    'resources_path' => env('ENTITY_SCAFFOLD_RESOURCE_PATH', '/'),


    /*
    |--------------------------------------------------------------------------
    | Requests Path
    |--------------------------------------------------------------------------
    |
    | Your Requests Path is located here App/Http/Requests/{ENTITY_SCAFFOLD_REQUEST_PATH}
    |
    */
    'requests_path' => env('ENTITY_SCAFFOLD_REQUEST_PATH', '/'),


];

And then change whatever path you want puts its key in .env ‍‍‍file like this:

ENTITY_SCAFFOLD_CONTROLLER_PATH=Admin/Dashboard
ENTITY_SCAFFOLD_MODEL_PATH=Entity

Credits

License

The MIT License (MIT). Please see License File for more information.

About

This package will help you to create a model,migration,controller,request,resource just by writing the name.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages