D2RTECH
issue with fillrecordusing
It is very surprising that this code did not worked on my Local machine, but when i hosted it on server, it worked absolutely fine.
here is the code snippet
ImportColumn::make('item_loaned')
->requiredMapping()
->fillRecordUsing(function (Inventory $record, string $state): void {
if(strtolower($state) === 'yes')
{
$record->item_loaned = 'Yes';
}
elseif (strtolower($state) === 'no') {
$record->item_loaned = 'No';
}
else {
$record->item_loaned = 'No';
}
})
->rules(['required', 'max:255']),
3 replies