pass several files to a laravale form

0

I have this method in which when I touch the file checks, all the files that are checked are displayed in my select

public function mostrar(Request $request){
      $clients = DB::table('clientes')->select('id','nombre')->where('pais', $_SESSION['country'])->get();
    $proyecto = DB::table('proyectos')->select('id','nombre','cliente')->get();
    $archivos = DB::table('files')->get();
    $grupo = DB::table('grupos')->get();
    $grupoCliente = DB::table('clients_group')->get();
    $Grupo =  $request->input('nombregrupo');
    $Archivos[] = $request->input('checkName');


    // echo($archi);


    // $arrayName = explode(",", $Archivos);
    foreach ($Archivos[0] as $key[0+1] => $ar) {

}    return view ('clientgroup / generateboletin', compact (['clients', 'project', 'files', 'group', 'customer group',             'Group', 'ar']));     }

<form class="form-group" method="POST"  name="formNombre" action="/Admin/clientgroup/generarboletin" enctype="multipart/form-data">

{{csrf_field ()}}                                         
          Documents         

    <div>
      <h6 style="position: absolute; left: 2%; top: 15%">Mostrar Documentos desde 
      </h6> <input style="position: absolute; left: 30%; top: 15%; border: none;" type='text' placeholder="2000/01/01" name="fecha1" class="data1" id='datetimepicker4' />  <p style="position: absolute;  left: 50%; top: 15%;">/</p>
      <input  style="position: absolute; left: 56%; top: 15%; border: none; " type='text' placeholder="2000/31/12" name="fecha2" class="data2" id='datetimepicker' />
      <input type="button" style="position: absolute; left: 85%; top: 15%;  text-decoration: none;
padding: 3px; font-weight: 3; font-size: 15px; color: #ffffff; background-color: #1883ba; border-radius: 8px;" data-token="{{csrf_token()}}"  value="Cargar más" name="searchCliente">
      <br>
      <br>
    </div>
    <div>
      <p style="position: absolute;left:  25%; ">Nombre</p>  <p style="position: absolute;left: 65%">Fecha</p>
    </div>
    <div class="datos">

       <div id="clientes" class="tipos">

    <div class="scroll" style="height:40%; width: 100% ; top: 8%; overflow: auto;">
     <table class="table table-bordered table-striped" style="height: 40%; width: 100%; top: 2%; ">
       <tbody style="height: 100%; width: 100%; top: 100%; border: none;">
         @foreach($archivos as $arch)
         <tr>
           <td><input type="checkbox" class="valor" id="{{$arch->id}}" value="{{$arch->id}}" name="checkName[]"></td>
           <td>{{$arch->name}}</td>
           <td>{{$arch->fecha}}</td>
         </tr>
         @endforeach
       </tbody>
     </table> 
    </div>
</div> 
     </div>
     <br>
       <br>
        </div>

   <div>
    @csrf
    <div class="datos">
      <textarea  name="nombregrupo" hidden="hidden" id="gruponombre"></textarea>
      <textarea name="nombrearchivos"  hidden="hidden" id="archivosnombre"></textarea>
    </div>
   </div>
   <div class="">   
    <input type="submit" data-token="{{csrf_token()}}" class="botoncolor" style="position: absolute;left:90%;top: 90%"  value="Siguiente" name="">
    <!-- <a href="/Admin/clientgroup/generarboletin"></a> -->
   </div>
   </div>

This is the form I use, and I pass the check [] in that way, only one file is passed and not the ones I select, and I do not know why the foreach does not give me every file that goes in that list

and this is the view to which those data are put that I position

<form class="form-group" method="POST"  name="formNombre" action="/clientgroup/generarboletin" enctype="multipart/form-data">

 <div class="clientes">
    <div class="titulo">
      Plantilla de correo  
    </div>
    <input type="hidden" name="func" value="ActualizarCliente">
    <input type="hidden" id="cliente-id" name="cliente-id" value="62">
      <div style="position: absolute; left: 10%; top: 8%">
       <b>Seleccione una plantilla: </b>
        <select onchange="SelecionPlantilla(this.value)">
          <option value="">Selecione una plantilla</option>
          <option value="1">Platilla Boletín</option>
          <option value="2">Plantilla Informativa</option>
          <option value="3">Plantilla Jurídica</option>
        </select>
      </div>
        <div style="position: absolute; left: 10%; top: 16%; visibility: visible;">

            <div class="panel panel-default">


                <div class="panel-body">
                    <form>
                        <textarea  class="ckeditor" name="editor1" id="editor1" rows="10" cols="80">

                        </textarea>
                    </form>
                </div>
            </div>
        </div>
        <div style="position: absolute; left: 10%; top: 83%">
          <input type="checkbox" name="machote" value="SI"> Guardar como machote?
        <hr>
        </div>

    </div>      


   <div class="">   
    <input type="submit"  style="position: absolute;left:80%;top: 95%"  value="Enviar Correo" name="">
    <a href="/Admin/clientgroup/genera"><input type="button" class="botoncolor" style="position: absolute; left: 73%; top: 95%" value="Regresar" name="">
     </a>
   </div>
   <div style="position: absolute; left: 10%; top: 96%">
          @foreach($grupo as $gr)
          @if($gr->id == $Grupo)
          <b><strong><output>{{$gr->name}} : </output></strong></b>
          @endif
          @endforeach
          <select>
          @foreach($archivos as $arc)
          @if($arc->id == $ar)
          <option id="arch" value="{{$arc->id}}">{{$arc->name}}</option>
          @endif
          @endforeach
          </select>
      </div>
   </div>
   <div class="datos">
      <input type="text" name="plantillas" hidden="hidden" id="plantilla">
   </div>

    
asked by Ricardo Rojas 04.12.2018 в 15:46
source

0 answers