Search code examples
laravelcontrollerviewmodelsreverse-engineering

Laravel generate models, views and controllers from database or migration script


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.


Solution

  • 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.