Laravel generate models, views and controllers fro

2020-07-29 02:24发布

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.

3条回答
Explosion°爆炸
2楼-- · 2020-07-29 02:56
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.

查看更多
何必那么认真
3楼-- · 2020-07-29 02:59

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)
查看更多
闹够了就滚
4楼-- · 2020-07-29 03:02

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.

查看更多
登录 后发表回答