morganrowse / laravelcrud
Artisan command to generate routing, views and controllers from a database table
Installs: 89
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 1
pkg:composer/morganrowse/laravelcrud
Requires
- doctrine/dbal: ^2.5
- laravel/framework: ^5.4
README
This composer package adds artisan commands which create Models, Views, Controllers and Request Validation for crud operation based off of a database table schema.
Installation
First add the package via composer
$ composer require morganrowse/laravelcrud dev-master
Use dev-master as I currently don't push tags
Usage
First have your database setup as desired following laravel naming convention (such as a table called posts).
Next run the command via artisan
$ php artisan make:crud posts
This will create:
app
│ Post.php
└───Http
│ └───Controllers
│ │ │ PostController.php
│ | └───View
│ │ │ | PostController.php
│ └───Requests
│ │ └───Post
│ │ │ │ DestroyPost.php
│ │ │ │ StorePost.php
│ │ │ │ UpdatePost.php
│ └───Resources
│ │ │ PostResource.php
resources
└───views
│ └───posts
│ │ │ create.blade.php
│ │ │ edit.blade.php
│ │ │ index.blade.php
│ │ │ show.blade.php
Now add the view routes to your web.php
... Route::resource('posts','View\\PostController'); ...
Finally add the api routes to your api.php
... Route::apiResource('posts','PostController'); ...