Модель:
Код: Выделить всё
protected $casts = [
'client' => 'array'
];
Компонент Livewire:
Код: Выделить всё
protected $rules = [
'editing.name' => 'required',
...
'editing.client' => 'present|array',
'editing.client.*.tenant' => 'required',
];
Компонент Livewire:
Код: Выделить всё
public function editModal(TokenCacheProvider $provider)
{
$this->editing = $provider;
$this->dispatchBrowserEvent('open-modal', ['modal' => 'edit']);
}
Лезвие:
Код: Выделить всё
Код: Выделить всё
foreach() argument must be of type array|object, string given

< /p>
Поэтому я не понимаю, почему атрибут client по-прежнему является строкой, а не массивом в том виде, в каком он был приведен.
Спасибо< /п>
Подробнее здесь: https://stackoverflow.com/questions/734 ... type-error
Мобильная версия