Laravel 4 - Inserting multiple records when using the hasMany relationship
问题 Still finding my feet with Laravel 4 and I'm a little unsure as to why this isn't working. In L3 I was able to insert multiple records to a table like so... $comments = array( array('message' => 'A new comment.'), array('message' => 'A second comment.'), ); $post = Post::find(1); $post->comments()->save($comments); However when I try to do similar now either the records are inserted without the foreign key, like so... $comments = array( array('message' => 'A new comment.'), array('message' =>