Saved data not showing in multiselect field

What I am trying to do:
Displaying the data that is picked from the multiselect.

What I did:
Made a new column in the database:
$table->json('value_types')->nullable();

Set cast to array & added it as fillable in the model.

Then in my resource added the following:
Select::make('value_types')
    ->label('Toon meter waarde')
    ->options([
      'temperature' => 'Temperatuur',
      'co2' => 'CO2',
      'movement' => 'Beweging',
      'pressure' => 'Druk',
      'illuminance' => 'Verlichting',
      'io_status' => 'IO Status',
      'humidity' => 'Vochtigheid',
     ])
     ->searchable()
     ->multiple()
     >columnSpan(2),


My issue/the error:
Values are saved correctly in the database, but when i reopen the form the multiselect field is empty. So it's not showing the values i just saved. When i then save the fields again it saves an empty array.
Was this page helpful?