I am new to Laravel 4. I wanted to know if it is possible to generate Models , Views and Controllers from existing database? I Googled and found
https://github.com/JeffreyWay/Laravel-4-Generators
But it allow to generate migration script, model, views and controllers by providing resource name where as i want to reverse engineering of the same in which by command line i want to create models, views and controllers from the existing database.
php artisan generate:model dbtablename
it will create individual model from your existing database. In this case you won't need the generate:resource
command.
php artisan generate:resource command
Laravel-4 Generators is very well documented. Read it thoroughly and you have fun.
If you're using Laravel 5, you might want to consider the Laravel 5 Extended Generators package.
I've had the same question, and couldn't find a good solution, so I started to build my own.
https://github.com/jimbolino/laravel-model-builder/
It's far from perfect, but is able to do the basic things like:
- Generate models
- Detect relations (probably buggy)
- Detect dates, auto increments
- Hidden fields (if you add a mysql comment)
Laravel 4 Migrations Generator: Automatically generates your migrations from an existing database schema. You will also find there the solution for Laravel-5.
At packalyst.com you will find how to generate the model automatically.