I am developing a project in which I have to save several files from a table, I can save them the problem is to update or edit I can not do it I get this error
"Argument 1 passed to Illuminate \ Database \ Grammar :: columnize () must be of the type array, integer given, called in C: \ xampp \ htdocs \ project \ vendor \ laravel \ framework \ src \ Illuminate \ Database \ Query \ Grammars \ Grammar.php on line 133 "
this the code of my sight
@foreach($archivos as $archivos)
<tr>
<td><input type="text" name="nombre_archivo[]" readonly="" value="{{$archivos->nombre_archivo}}"></td>
<td><input type="file" name="archivo_unidad[]" value="{{$archivos->archivo_unidad}}"></td>
<td>
@if(!isset($archivos->archivo_unidad) || $archivos->archivo_unidad == "NULL")
<label>Sin archivos</label>
@else
<a href='{{ url ('download_archivo',$archivos->archivo_unidad)}}' target="_blank">Descargar</a>
@endif
</td>
</tr>
@endforeach
this is my controller
$nombre = $request->input('nombre_archivo');
$file = $request->file('archivo_unidad');
foreach ($request->input('nombre_archivo') as $key => $value) {
if(!isset($file[$key])){
$archivo = DB::table('archivos_unidades')->where('id_unidad', '=', decrypt($id))->value('archivo_unidad');
}else{
$archivo = time()."_".$file[$key]->getClientOriginalName();
\Storage::disk('archivosunidades')->put($archivo, \File::get($file[$key]));
}
$objModel = ArchivosUnidades::find('id_unidad', decrypt($id));
$objModel->nombre_archivo = $nombre[$key];
$objModel->id_unidad = $unidades->id_unidad;
$objModel->archivo_unidad = $archivo;
$objModel->save(); }
I can not identify what the error is, I stress that in ArchivosUnidades::find('id_unidad', decrypt($id));
id_unidad is not the primary key of the FilesUnits table but the foreign key that is related to my main table called units