Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel Use hasMany to create Many

 $post = Post::find(1);
 $post->comments()->saveMany([
	 new Comment(['message' => 'First comment']),
	 new Comment(['message' => 'Second comment'])
]);
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #Use #hasMany #create #Many
ADD COMMENT
Topic
Name
9+6 =