I try using multiselect when creating record but I get error Array to String. But when I update record everything is ok.
Panel::make('Material', [
MultiSelect::make('Select materials', 'material_id')
->options(Material::orderBy('name', 'ASC')->get()->pluck('name', 'id'))
->hideFromIndex(),
]),
I need hide this filed when creating record to use him on update.
Thanks.
What database type is material_id
? Make sure it's a database field that allows to save array's.
One other thing that could cause this if you didn't cast the field in your model to array
<?php
namespace App\Models;
class Model
{
protected $casts = [
'material_id' => 'array',
];
}