[英]Form::model for One-to-one Relationship
I have a User model that has a one-to-one relationship with a Writer model. 我有一个与Writer模型具有一对一关系的User模型。
I'm trying to use Form::model($user, ['route' => 'some-route'])
to populate the form with values from both User and Writer model but I only see values from the User model (since that's what I passed as argument in Form::model()
). 我正在尝试使用
Form::model($user, ['route' => 'some-route'])
用来自User和Writer模型的值填充表单,但是我只看到来自User模型的值(因为这就是我在Form::model()
作为参数传递的内容。
I wish I could do Form::text('writer.something')
but can't. 我希望我能做
Form::text('writer.something')
但不能。 Are there other ways to achieve it? 还有其他方法可以实现吗? Or it's a bad idea to do it that way?
还是这样做不是一个好主意?
Regards. 问候。
This is feature not implemented in Laravel 4.0.0 Laravel 4.0.0中未实现此功能
I hope it gets implemented in future updates. 我希望在以后的更新中实现它。 :)
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.