douou1872 2016-04-14 12:10
浏览 79
已采纳

如何从已编辑的模型生成laravel-migrations?

I've been looking into PHP-frameworks lately to find out which suits me best. I've had some experience with the java Play! framework which did some very nice things. One very nice feature that I haven't found in Laravel yet, is that when you edit your model, it can generate migrations for you. Is there a way in Laravel to generate migrations automatically from edits on your model? This would seem like a huge improvement to me, since migrations seem like a bit of a hassle to me right now.

I'm looking forward to your opinions and help!

  • 写回答

1条回答 默认 最新

  • doujichan1399 2016-04-14 12:22
    关注

    You only specify the columns in the migration and not on the model, so you don't have to edit anything on the model.

    You first specify the columns (properties) for a table in the migrations. Then you use those properties in your Eloquent Models.

    You don't have to put all properties in the model, when you create a column with a migration it is accessable via a model, without also specifying it in the model.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 全志H618ROM新增分区
  • ¥20 jupyter保存图像功能的实现
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况