0
   public function edit($id)
   {
    $blogs=Blog::findOrFail($id);
    $tags =$blogs->tags;
    $metaKeywords = $blogs->keywords;       
   return  view('admin.cms.blogs.edit_blog',compact('blogs','tags','metaKeywords'));
     }

And my view

<input  type="text" class="form-control product-tags"
 name="tags"
  @foreach($tags as $tag ) value="{{ $tag->tag_name }} "
 @endforeach>

I'm getting only a single valve text box,but there many tags in database please suggest me an idea

5
  • You want to put all tags in one textbox, want to generated multiple text boxes? Commented Mar 14, 2017 at 5:11
  • 1
    hi anil ,I want to put all tags in one text box Commented Mar 14, 2017 at 5:16
  • Blog::findOrFail, which ORM? U can use ORM's concat function. Commented Mar 14, 2017 at 5:20
  • 1
    I'm using elquent ORM Commented Mar 14, 2017 at 5:32
  • You can use DB::raw('group_concat(tag)'), refer stackoverflow.com/questions/31964258/… and stackoverflow.com/questions/25847738/… to return one string for all tags Commented Mar 14, 2017 at 5:41

1 Answer 1

1

Try

<input  type="text" class="form-control product-tags" name="tags"
value = "@foreach($tags as $tag ){{ $tag->tag_name }} @endforeach">
Sign up to request clarification or add additional context in comments.

2 Comments

No it dint work,getting all tags together which is not correct.
this will loop through all of your tags which you get from controller. Make sure you have constrain to you eloquent query when getting tags.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.