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

ぐ巨炮叔叔 提交于 2019-12-04 18:11:57
Rokib
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)
Mohaimin Moin

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!