bluecode/laravel-generator

Laravel Generator

dev-master 2017-09-16 02:05 UTC

This package is not auto-updated.

Last update: 2024-04-13 15:17:49 UTC


README

Codacy Badge Latest Stable Version Total Downloads Latest Unstable Version License

This package extend make laravel command to use custom template. Further more, add some new command as generate mvc, create new package.

Documentation is in process...

Documentation

  1. Installation
  2. Publish
  3. Generator Command
  4. Option

Installation

  1. Add this package to your composer.json:
composer require bluecode/laravel-generator
  1. Run composer update
composer update
  1. Add the ServiceProviders to the providers array in config/app.php
Bluecode\Generator\GeneratorServiceProvider::class,

As we are using laravelcollective/htmlas a dependency
so we need to add those ServiceProviders as well.

Collective\Html\HtmlServiceProvider::class,

Also for convenience, add these facades in alias array in config/app.php

'Form'      => Collective\Html\FormFacade::class,
'Html'      => Collective\Html\HtmlFacade::class,

Publish

  1. Publish configuration file generator.php
php artisan vendor:publish --tag=laravel-generator.config
  1. Publish template folder into resources/vendor/laravel-generator/templates
php artisan vendor:publish --tag=laravel-generator.template

Generator Command

  1. Generate Migration:
php artisan gen:migrate MigrationName

e.g.

php artisan gen:migrate create_posts_table
  1. Generate Model:

php artisan gen:model ModelName

e.g.

php artisan gen:model Post
  1. Generate Controller
php artisan gen:model ModelName

e.g.

php artisan gen:model Post
  1. Generate View
php artisan gen:view ViewName

e.g.

php artisan gen:view index
php artisan gen:view create
  1. Generate MVC:
php artisan gen:mvc ModelName

e.g.

php artisan gen:mvc Post
php artisan gen:mvc Post --actions=index,create,edit
  1. Generate Package
  php artisan gen:package VendorName PackageName

e.g.

php artisan gen:package Module Post
php artisan gen:package Module Post --path=packages/post
php artisan gen:package Module Post --actions=index,create,edit

Option

Use --overwrite to overwrite exist file on all command.

Credits

This Laravel Generator is created by Bluecode.

Bugs & Forks are welcomed :)