Giter VIP home page Giter VIP logo

laravel-generator's Introduction

Laravel Generator

The Laravel Generator is a Laravel CLI command which aim is to help the development process of Laravel applications by providing some convenient code-generation capabilities.

At the moment, this package is capable of generating the following:

  • Models - with eloquent relations
  • Migrations - with custom field types and foreign keys relations
  • Factories - with proper faker types
  • Seeders

This package was forked from reliese/laravel and it was improved to support more features. Also, I'm using the package kitloong/laravel-migrations-generator to support migration generation.

How does it work?

This package expects that you are using Laravel 5.1 or above. You will need to import the daniloesser/laravel-generator package via composer:

composer require daniloesser/laravel-generator

Configuration

Add the service provider to your config/app.php file within the providers key:

// ...
'providers' => [
    /*
     * Package Service Providers...
     */

    CliGenerator\Code\CodeServiceProvider::class,
],
// ...

Configuration for local environment only

If you wish to enable generators only for your local environment, you should install it via composer using the --dev option like this:

composer require daniloesser/laravel-generator --dev

Then you'll need to register the provider in app/Providers/AppServiceProvider.php file.

public function register()
{
    if ($this->app->environment() == 'local') {
        $this->app->register(\CliGenerator\Code\CodeServiceProvider::class);
    }
}

Custom configuration

Add the cli-generator.php configuration file to your config directory and clear the config cache:

php artisan vendor:publish --tag=cli-generator
php artisan config:clear

Usage

  • Invoke the generator:
php artisan code:generate
  • You can also specify the connection:
php artisan code:generate --connection=mysql
  • You will be prompted for which tables you want to scaffold from a list. You can pass more than one, separating them by a comma:
E.G: cities,states,countries
  • Additionally, you can inform a Model sub-folder to create the files in a specific folder/namespace:
E.G: Payment
  • After finishing Models generation, you will be prompted for migrations and factories generation as well.

Support

For now, this package only supports MySQL databases.

Some customization is possible. Just check options inside cli-generator file.

laravel-generator's People

Contributors

daniloesser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.