0

I have the following trouble.. I want to create form with binding to model.

My tables structure:

Table "Pages"
- id
- isHidden
- isDeleted

Table "Contents"
- id
- title
- content

Table "Seo"
- id
- title
- description
- keywords

Table "Contents_Pages"
- page_id
- content_id
- language_id

Table "Contents_Seo"
- page_id
- seo_id

Models structure

Model "Page"
public function content() {
    return $this->belongsToMany('Content');
}

Model "Content"
public function seo() {
    return $this->belongsToMany('Seo');
}

How to create it in one form, in view?

tshepang
  • 12,111
  • 21
  • 91
  • 136
lieroes
  • 674
  • 2
  • 12
  • 29
  • why you want so many table you can create one table and put all these columns in it. if it is single language. – umefarooq Mar 26 '14 at 10:49
  • you can use blog_post table as example from this schema design http://www.laravelsd.com/share/s4UjqE – umefarooq Mar 26 '14 at 10:58
  • Hmm.. okey, i changed my tables structure, but question is still actual - how can i bind form to model, with automatically filled fields? – lieroes Mar 26 '14 at 11:03
  • {{ Form::model($pageModel, array('route' => array('admin.page.update'))) }} {{ Form::text('alias', NULL, ); }} {{ Form::close() }} - This alias field fill automatically.. – lieroes Mar 26 '14 at 11:03
  • you field name should be same as column name in database table if you have column name email then you text field should be same name {{ Form::text('email', ); }} – umefarooq Mar 26 '14 at 11:17
  • check this video will help you more http://www.youtube.com/watch?v=EJwxG3b9j9c – umefarooq Mar 26 '14 at 11:26

0 Answers0