Laravel Scaffold Generator, for Laravel 5.3.
composer require 'summerblue/generator' --dev
Open /app/Providers/AppServiceProvider.php
and, to your register function, add:
public function register()
{
if (app()->environment() == 'local' || app()->environment() == 'testing') {
$this->app->register(\Summerblue\Generator\GeneratorsServiceProvider::class);
}
}
You're all set. Run php artisan
from the console, and you'll see the new commands make:scaffold
.
Use this command to generator scaffolding of Project in your project:
php artisan make:scaffold Projects --schema="name:string:index,description:text:nullable,subscriber_count:integer:unsigned,default(0)"
This command will generate:
$ php artisan make:scaffold Projects --schema="name:string:index,description:text:nullable,subscriber_count:integer:unsigned,default(0)"
----------- scaffolding: Project -----------
+ ./database/migrations/2017_01_30_233548_create_projects_table.php
+ ./database/factories/ModelFactory.php
+ ./database/seeds/ProjectTableSeeder.php
+ ./database/seeds/DatabaseSeeder.php (Updated)
+ ./app/Models/Model.php (Updated)
+ ./app/Models/Traits/ProjectOperation.php
+ ./app/Models/Project.php
+ ./app/Http/Controllers/ProjectController.php
+ ./app/Http/Requests/Request.php
+ ./app/Http/Requests/ProjectStoreRequest.php
+ ./app/Http/Requests/ProjectUpdateRequest.php
+ ./app/Policies/Policy.php
+ ./app/Policies/KnowledgeBasePolicy.php
+ ./app/Providers/AuthServiceProvider.php (Updated)
+ ./routes/web.php (Updated)
--- Views ---
+ create_and_edit.blade.php
+ index.blade.php
+ show.blade.php
+ ./resources/views/error.blade.php
Migrated: 2017_01_30_233548_create_projects_table
----------- -------------------- -----------
----------- >DUMP AUTOLOAD< -----------
Generate the following:
- Migration
- Seed, add ModelFactory entry, and DatabaseSeeder entry
- Base Model class, Model and helper trait
- Resource Controller
- Base FormRequest class and StoreRequest, UpdateRequest
- Policy and Policy base class, auto register AuthServiceProvider class
- Update routes file to register resource route
- Add error page view
- Create and Edit action share the same view
- API
- Admin
- Auto fill FormRequest rule
- Auto fill ModelFactory filed