I have created a vehicle add-on form using Filament. Adding and listing functionality is completed. However, when I click the edit button, the fields with related data are not pre-selected. How can I ensure that the related data is selected in the edit form? The form is created in the AddOn resource, and the AddOn model has a hasMany relationship with the AddOnVehicleType model
Select::make('vehicle_type')->multiple()
->label('Vehicle Type')
->options(function () {
return AppModelsVehicleType::pluck('name', 'id');
})
->searchable()
->placeholder('Vehicle Type')->required(),
//AddOn.php
public function addOnVehicleType()
{
return $this->hasMany(AddOnVehicleType::class);
}