title: How to get data from a line and move to a modal? Laravel 5.4
body: <p>I have a table where listo products from my database, in it I have ID, name, description, among other data types. I created a button that would call a modal to display more details about the product, however the modal always displays details of the first product in the table and not the ID related to it.</p>
  
  <p><strong>My table:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/YcTM1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YcTM1.png" alt="enter image description here"></a></p>
  
  <p><strong>My table code:</strong> </p>
  
  <pre><code>    &lt;table class="table table-striped table-bordered" id="table1" class="table table-bordered"&gt;
                                  &lt;thread&gt;
                                      &lt;th&gt;&lt;center&gt;Imagem&lt;/center&gt;&lt;/th&gt;
                                      &lt;th&gt;SKU&lt;/th&gt;
                                      &lt;th&gt;&lt;center&gt;Produto&lt;/center&gt;&lt;/th&gt;
                                      &lt;th&gt;Custo&lt;/th&gt;
                                      &lt;th&gt;Preço&lt;/th&gt;
                                      &lt;th&gt;Atualização&lt;/th&gt;
                                      &lt;th&gt;Status&lt;/th&gt;
                                      &lt;th&gt;Estoque&lt;/th&gt;
                                      &lt;th&gt;Distruibuidor&lt;/th&gt;
                                      &lt;th&gt;Categoria&lt;/th&gt;
                                      &lt;th id="acoes"&gt;Ações&lt;/th&gt;
                                  &lt;/thread&gt;
                                  @foreach($product as $prod)
                                      &lt;thread&gt;
                                          &lt;tbody&gt;
                                          &lt;td&gt;&lt;img src="{{$prod-&gt;image-&gt;erp_image}}" style="width: 50px; height: 50px;" alt="" id="ProdImage"&gt;&lt;/td&gt;
                                          &lt;td&gt;{{$prod-&gt;erp_model}}&lt;/td&gt;
                                          &lt;td&gt;{{$prod-&gt;description-&gt;erp_name}}&lt;/td&gt;
                                          &lt;td&gt;R$ {{$prod-&gt;erp_cost}}&lt;/td&gt;
                                          &lt;td&gt;R$ {{$prod-&gt;erp_price}}&lt;/td&gt;
                                          &lt;td&gt;{{ $prod-&gt;erp_modifieddate}}&lt;/td&gt;
                                          &lt;td style="max-width: 45px"&gt;
                                              @if($prod-&gt;status == 1)
                                                  &lt;span class="label label-success"&gt;Ativo&lt;/span&gt;
                                              @else
                                                  &lt;span class="label label-danger"&gt;Inativo&lt;/span&gt;
                                              @endif
                                          &lt;/td&gt;
                                          &lt;td&gt;{{ $prod-&gt;erp_quantity}}&lt;/td&gt;
                                          &lt;td&gt;@if($prod-&gt;erp_distributor == 'A')
                                                  &lt;span class="label label-default"&gt;Aldo&lt;/span&gt;
                                              @elseif($prod-&gt;erp_distributor == 'AN')
                                                  &lt;span class="label label-default"&gt;All Nations&lt;/span&gt;
                                              @elseif($prod-&gt;erp_distributor == 'H')
                                                  &lt;span class="label label-default"&gt;Hayamax&lt;/span&gt;
                                              @elseif($prod-&gt;erp_distributor == 'O')
                                                  &lt;span class="label label-default"&gt;Oderço&lt;/span&gt;
                                              @elseif($prod-&gt;erp_distributor == 'R')
                                                  &lt;span class="label label-default"&gt;Rico Peças&lt;/span&gt;
                                              @endif
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              @foreach($prod-&gt;category as $category)
                                                  {{$category-&gt;erp_name}}
                                              @endforeach
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;button href="#" data-toggle="modal" data-target="#view" class="btn btn-default"&gt;&lt;i class="glyphicon glyphicon-eye-open"&gt;&lt;/i&gt;&lt;/button&gt;
                                              &lt;div class="modal fade" id="view" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"&gt;
                                                  &lt;div class="modal-dialog" role="document"&gt;
                                                      &lt;div class="modal-content"&gt;
                                                          &lt;div class="modal-header"&gt;
                                                              &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;
                                                              &lt;h4 class="modal-title" id="myModalLabel"&gt;Detalhes&lt;/h4&gt;
                                                          &lt;/div&gt;
                                                          &lt;div class="modal-body"&gt;
                                                              &lt;div class="panel panel-default"&gt;
                                                                  &lt;div class="panel-heading"&gt;
                                                                      &lt;h3 class="panel-title"&gt;Informações do produto&lt;/h3&gt;
                                                                  &lt;/div&gt;
                                                                  &lt;div class="panel-body"&gt;
                                                                      &lt;h5&gt;Nome&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="{{$prod-&gt;description-&gt;erp_name}}" readonly&gt;
                                                                      &lt;h5&gt;SKU&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="{{$prod-&gt;erp_model}}" readonly&gt;
                                                                      &lt;h5&gt;EAN&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="{{$prod-&gt;erp_ean}}" readonly&gt;
                                                                      &lt;h5&gt;NCM&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="{{$prod-&gt;erp_ncm}}" readonly&gt;
                                                                      &lt;h5&gt;CST&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="{{$prod-&gt;erp_cstid}}" readonly&gt;
                                                                      &lt;h5&gt;Marca&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="{{$prod-&gt;brand-&gt;erp_name}}" readonly&gt;
                                                                      &lt;h5&gt;Categoria&lt;/h5&gt;
                                                                      @foreach($prod-&gt;category as $category)
                                                                          &lt;input class="form-control" type="text" placeholder="{{$category-&gt;erp_name}}" readonly&gt;
                                                                      @endforeach
                                                                      &lt;h5&gt;Distribuidor&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="{{ App\Helpers\ProductDistributorHelper::$distributor[$prod-&gt;erp_distributor]}}" readonly&gt;
                                                                  &lt;/div&gt;
                                                              &lt;/div&gt;
                                                              &lt;div class="panel panel-success"&gt;
                                                                  &lt;div class="panel-heading"&gt;
                                                                      &lt;h3 class="panel-title"&gt;Informações dos preços&lt;/h3&gt;
                                                                  &lt;/div&gt;
                                                                  &lt;div class="panel-body"&gt;
                                                                      &lt;h5&gt;Preço custo&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="R$ {{$prod-&gt;erp_cost}}" readonly&gt;
                                                                      &lt;h5&gt;Preço venda&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="R$ {{$prod-&gt;erp_price}}" readonly&gt;
                                                                  &lt;/div&gt;
                                                              &lt;/div&gt;
                                                              &lt;div class="panel panel-success"&gt;
                                                                  &lt;div class="panel-heading"&gt;
                                                                      &lt;h3 class="panel-title"&gt;Informações de peso e medida&lt;/h3&gt;
                                                                  &lt;/div&gt;
                                                                  &lt;div class="panel-body"&gt;
                                                                      &lt;h5&gt;Peso&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="{{$prod-&gt;erp_weight}} kg" readonly&gt;
                                                                      &lt;h5&gt;Comprimento&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="{{$prod-&gt;erp_lenght}} cm" readonly&gt;
                                                                      &lt;h5&gt;Largura&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="{{$prod-&gt;erp_width}} cm" readonly&gt;
                                                                      &lt;h5&gt;Altura&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="{{$prod-&gt;erp_height}} cm" readonly&gt;
                                                                  &lt;/div&gt;
                                                              &lt;/div&gt;
                                                              &lt;div class="panel panel-danger"&gt;
                                                                  &lt;div class="panel-heading"&gt;
                                                                      &lt;h3 class="panel-title"&gt;Informações de estoque&lt;/h3&gt;
                                                                  &lt;/div&gt;
                                                                  &lt;div class="panel-body"&gt;
                                                                      &lt;h5&gt;Quantidade&lt;/h5&gt;
                                                                      &lt;input class="form-control" type="text" placeholder="{{$prod-&gt;erp_quantity}}" readonly&gt;
                                                                  &lt;/div&gt;
                                                              &lt;/div&gt;
                                                              &lt;div class="panel panel-danger"&gt;
                                                                  &lt;div class="panel-heading"&gt;
                                                                      &lt;h3 class="panel-title"&gt;Informações técnicas e descrição&lt;/h3&gt;
                                                                  &lt;/div&gt;
                                                                  &lt;div class="panel-body"&gt;
                                                                      &lt;h5&gt;Descrição&lt;/h5&gt;
                                                                      &lt;p&gt;&lt;/p&gt;
                                                                  &lt;/div&gt;
                                                              &lt;/div&gt;
                                                              &lt;div class="modal-footer"&gt;
                                                                  &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;OK&lt;/button&gt;
                                                              &lt;/div&gt;
                                                          &lt;/div&gt;
  
                                                      &lt;/div&gt;
                                                  &lt;/div&gt;
                                              &lt;/div&gt;
                                          &lt;/td&gt;
                                          &lt;style&gt;
                                              td{
                                                  max-width: 100px;
                                                  min-width: 80px;
                                              }
                                          &lt;/style&gt;
                                          &lt;/tbody&gt;
  
                                      &lt;/thread&gt;
                                  @endforeach
                              &lt;/table&gt;
  </code></pre>
  
  <p><strong>My Controller</strong></p>
  
  <pre><code>public function showView($name=null){
      if(View::exists('admin/'.$name))
      {
          $product = Product::paginate(10);
          if(Sentinel::check())
              return view('admin.'.$name)-&gt;with('product', $product);
          else
              return redirect('admin/signin')-&gt;with('error', 'You must be logged in!');
      }
      else
      {
          return view('admin.404');
      }}
  </code></pre>
  
  <p>Any Suggestion?</p>