user7320608
user7320608

Reputation:

Laravel fetch tags from mysql

   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

Upvotes: 0

Views: 199

Answers (1)

usrNotFound
usrNotFound

Reputation: 2810

Try

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

Upvotes: 1

Related Questions