Have you checked the WithValidation trait ?
Excel Import
I am using https://laravel-excel.com/ package and livewire. I would like to import an excel file but with some kind of validation. I want to look up a certain row containing a specific value. The name and the current week. The name should be strict as per the form request and check the week of the same row. Is this possible?
public function model(array $row)
{
return new Auctioncatalogue([
'si_no' => $row[0],
'producer' => $row[1],
'mark' => $row[2],
'warehouse' => $row[3],
'entry_no' => $row[4],
'broker_value' => $row[5],
'lot_no' => $row[6],
'grade' => $row[7],
'manufacturing_date' => $row[8],
'invoice_no' => $row[9],
'packages' => $row[10],
'packing_type' => $row[11],
'total_net_weight' => $row[12],
'total_gross_weight' => $row[13],
'auction_no' => $row[14],
'auction_date' => $row[15],
'warehouse_location' => $row[16],
'broker' => $row[17],
'primary/secondary' => $row[18],
'packing_weight' => $row[19],
'tare_weight' => $row[20],
'certification' => $row[21],
'current_quantity' => $row[22],
'current_packages' => $row[23],
'warrant_no' => $row[24],
'act_in_action' => $row[25],
]);
}
when uploading I would like for the 'broker' field to be the same as what I will use to validate the whole import. The reason being the excel files will be many and would like to reduce duplication. The other thing is that files are weekly updated, thus the 'auction date' field should be within a certain week and validated also. is this kind of validation possible
Please or to participate in this conversation.