You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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.
The text was updated successfully, but these errors were encountered: