使用Laravel 4自动生成模型类(也称使用带L4的现有数据库) [英] Autogenerate model classes with Laravel 4 (aka using an existing database with L4)

查看:194
本文介绍了使用Laravel 4自动生成模型类(也称使用带L4的现有数据库)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MySQL Workbench中设计了我的数据库,并设置了所有的外键等。



我想使用这个DB模式与Laravel 4但是,从文档来看,没有任何一种能够使用现有数据库表的能力。从我的理解,其他框架,如蛋糕与其烘烤允许您根据数据库中已经存在的表自动生成您的模型类。



我已经看过周围无处不在,对于Laravel 4,完全不了解这一切。我发现最近的事情是Jeffrey Way的工匠发电机包,但这只能创建基本模型,并且不会检测出已建立的外键关系。



这是否可能与Laravel 4或者我要手动完成这一切?

解决方案

好消息是,Antonio刚刚完成了他的 MySQL WorkBench到雄辩的ORM转换器
这是一个美丽的解决方案,但是为我迟到,但可以帮助你很多。



更新:该链接暂时不起作用。 wabpage说我们正在重新设计的东西,很快就会回来!我已经发送电子邮件问他,当这项服务将再次可用。



安东尼奥说,它会回来,但没有预计到达时间。我们必须等待..


I've designed my database in MySQL Workbench, and have all my foreign keys setup, etc.

I'm wanting to use this DB schema with Laravel 4, however from the docs there is no word of any sort of ability to work with an existing set of database tables. From my understanding, other frameworks such as Cake with its 'Baking' allow you to automatically generate your model classes based on the tables already in your database.

I've looked around everywhere and cant see anything about this at all for Laravel 4. The closest thing I've found is Jeffrey Way's Generator package for artisan, however this only creates the base model, and doesn't detect established foreign key relationships.

Is this even possible with Laravel 4 or am I going to have to just do it all manually?

解决方案

The good news is that Antonio just finished his MySQL WorkBench to Eloquent ORM converter This is a beautiful solution but comes a way to late for me but may help you a lot.

Update: The link isn't working in the moment. The wabpage says "We are redesigning things, will be back soon!". I allready sent antonio an email asking him, when this service will be available again.

Antonio said that it'll be back but there is no estimated time of arrival. We have to wait..

这篇关于使用Laravel 4自动生成模型类(也称使用带L4的现有数据库)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆