i have this error when I try to send an array to my database table. i have this on my update method
$post = Post::findOrFail($id);
$post->PostTitle = $request->PostTitle;
$post->post = $request->post;
$tags = new Tag;
foreach ($request->tags as $tags) {
$tag = Tag::create(['tag'=>$tags]);
if($tag->save()){
$post->tags()->sync($tag->id);
}
}
this is my html form
<div class="post-panel-3">
<div class="form-group">
<label for="postTags">Etiquetas: </label>
<input type="text" name="taggged[]" class="form-control" placeholder="Etiquetas" value="<?php if(isset($post->tags)){ foreach($post->tags as $tag); echo $tag->tag;} ?>" id="tagBox2">
I have ManyToMany relationship model, all run fine in create method but no on update. I think i miss something but not finded yet.
via Johanng1993