maztch / laravel-generator
Laravel API/Scaffold/CRUD Generator based on Mitul Golakiya (me@mitul.me).
Requires
- php: >=5.5.9
- illuminate/support: 5.2.*
Suggests
- doctrine/dbal: Required to use generator from existing table.
This package is not auto-updated.
Last update: 2024-11-19 04:48:00 UTC
README
Other versions:
5.1.* | 1.0
Based on Mitul generator, this is a more simple scaffold and just need to be used in dev.
I did this beacuse i need more simple generator and keep all out the repo dependencies in production.
Diferences with Mitul:
There are no Requests and there are no Library/Repositories Base controller is removed (Maztch/Controller/AppBaseController) Added delete function in controller for DELETE method and keep destroy just as an alias.
Except for this, is exactly the same.
The artisan command can generate the following items:
- Migration File
- Model
- Controller
- View
- index.blade.php
- table.blade.php
- show.blade.php
- show_fields.blade.php
- create.blade.php
- edit.blade.php
- fields.blade.php
- adjusts routes.php
Documentation is in process...
Documentation
While we write the docs you can take a look to Mitul repo.
Installation
-
Add this package to your composer.json:
"repositories": [ { "type": "git", "url": "https://github.com/mitulgolakiya/laracast-flash" } ], "require": { "laracasts/flash": "dev-master", "laravelcollective/html": "5.2.*@dev", "bosnadev/repositories": "dev-master", "maztch/laravel-generator": "dev-master" }
-
Run composer update
composer update
-
Add the ServiceProviders to the providers array in
config/app.php
.
As we are using these two packages laravelcollective/html & laracasts/flash as a dependency.
So we need to add those ServiceProviders as well.
Collective\Html\HtmlServiceProvider::class,
Laracasts\Flash\FlashServiceProvider::class,
Maztch\Generator\GeneratorServiceProvider::class,
Also for convenience, add these facades in alias array in config/app.php
.
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
'Flash' => Laracasts\Flash\Flash::class
Configuration
Publish Configuration file generator.php
.
php artisan vendor:publish --provider="Maztch\Generator\GeneratorServiceProvider"
Publish & Initialization
Mainly, we need to do three basic things to get started.
-
Publish some common views like
errors.blade.php
&paginate.blade.php
. -
Publish
api_routes.php
which will contain all our api routes. -
Init
routes.php
for api routes. We need to includeapi_routes.php
into mainroutes.php
.php artisan maztch.generator:publish