Please format your code by adding ``` before and after it. Also if you write in English we are more that can help you
Nov 8, 2022
13
Level 1
htmlspecialchars(): Argument #1 ($string) must be of type string, array given
I am trying to edit a form that I am making but it always gives me this error, I am using Laravel 9
model
class Documento extends Model
{
use HasFactory;
protected $fillable = [
'sigla',
'nombre',
'orden',
];
protected $primaryKey = 'idtipodocumento';
}
controller
public function edit($idtipodocumento)
{
$documento = Documento::find($idtipodocumento);
return view('documentos.editar', compact('documento'));
}
index view
@foreach ($documentos as $documento)
<tr>
<td style="display: none;">{{ $documento->idtipodocumento }}</td>
<td>{{ $documento->sigla }}</td>
<td>{{ $documento->nombre }}</td>
<td>{{ $documento->orden }}</td>
</tr>
@endforeach
edit view
<div class="col-lg-12">
<div class="card">
<div class="card-body">
{!! Form::model($documento, [
'method' => 'PATCH',
'route' => ['documentos.update', $documento->idtipodocumento],
]) !!}
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<label for="">Sigla*</label>
{!! Form::text('sigla', ['class' => 'form-control']) !!}
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<label for="">Nombre*</label>
{!! Form::text('nombre', ['class' => 'form-control']) !!}
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<div class="form-group">
<label for="">Orden*</label>
{!! Form::number('orden', ['class' => 'form-control']) !!}
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<button type="submit" class="btn btn-primary">Guardar</button>
</div>
</div>
{!! Form::close() !!}
</div>
I have already tried in several ways to solve the error but I still can't find it, I appreciate your help, thank you very much
Please or to participate in this conversation.