'"Array to string conversion" error when updating fields to livewire
enter image description hereI want to edit a row as a fullpage.
The data is bound, but the fields give an "Array to string conversion" error when they are updated (when I type in the fields).
It does not give an error when I manually write the parameter in the query and do not use the route parameter. But I use route (according to the following code) gives the image error:
Route::get('Barnames/Edit/{Bar}', EditBar::class)-;
I delete this parameter {Bar. I can update the fields without error (I type inside the fields).
This is my code:
<?php
namespace App\Http\Livewire\Barnames;
use Livewire\Component;
class EditBarname extends Component
{
public $Barname = [];
public function mount()
{
$this->Barname =['maghsad'=>"testi"];
}
public function render()
{
return view('livewire.barnames.testi')
->extends('layouts.app')
->section('content');
}
}
view:
<div>
<input wire:model='Barname.maghsad' type="text" class="form-control">
</div>
route :
Route::get('Bar/Edit/{Bar?}', EditBar::class)->name('EditBar')->middleware('auth');
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
