Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One to many relationship fails to function well. #10

Open
shegunbabs opened this issue Jan 15, 2014 · 0 comments
Open

One to many relationship fails to function well. #10

shegunbabs opened this issue Jan 15, 2014 · 0 comments

Comments

@shegunbabs
Copy link

Following the model examples in the Laravel docs
I had this Model-Validation method implemented in my app and inserting related models failed to work.

$posts = new Posts(array('title'=>'My post title','body'=>'the body'));
Author::find(1)->posts()->save($posts);

The snippet above doesn't create a valid row in the database, rather it creates a record for the foreign key (author.author_id) in the post table and all other fields are empty.

I had to extend Eloquent directly from my model to get the appropriate result.

I hope someone can confirm this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant