F
Filament7mo ago
terumi

Importing with extra data

Hello people, is it possible to import some data to the application using the csv importer but to add extra data using a select box? I want to do something like ImportColumn::make('campaign') ->relationship(Campaign::class, 'name'), ImportColumn::make('surname') ->requiredMapping() ->rules(['required']), Select::make('some_data') ->options(['asd', 'sasd', 'etc'])... Is that possible?
1 Reply
Grasshopper
Grasshopper7mo ago
public static function getOptionsFormComponents(): array
{
return [
TextInput::make('name')
->label('List Name')
->required()
->columnSpanFull(),
Textarea::make('description')
->label('Description')
->columnSpanFull(),

Toggle::make('dupeCheck')
->label('Dupe Check')
->default(true)
->helperText('Check for duplicates in just this list'),

Toggle::make('globalDupeCheck')
->label('Dupe Check: All Existing Lists')
->default(true)
->helperText('Check for duplicates across all lists'),

Select::make('leadType')
->label('Lead Type')
->options(LeadType::class)
->default(LeadType::ELECTRICITY->value)
->required()
->columnSpanFull(),
];
}
public static function getOptionsFormComponents(): array
{
return [
TextInput::make('name')
->label('List Name')
->required()
->columnSpanFull(),
Textarea::make('description')
->label('Description')
->columnSpanFull(),

Toggle::make('dupeCheck')
->label('Dupe Check')
->default(true)
->helperText('Check for duplicates in just this list'),

Toggle::make('globalDupeCheck')
->label('Dupe Check: All Existing Lists')
->default(true)
->helperText('Check for duplicates across all lists'),

Select::make('leadType')
->label('Lead Type')
->options(LeadType::class)
->default(LeadType::ELECTRICITY->value)
->required()
->columnSpanFull(),
];
}
Add a getOptionsFormComponents method to your importer with your form fields.
Want results from more Discord servers?
Add your server