RoseRiyadh
Importer: beforesave() hook check
@HeartlandTechie I resolved it like this in XImporter.php
public function resolveRecord(): ?Voucher
{
$product = Product::where('slug', $this->data['slug'])->first();
if (!is_null($product))
{
return new Voucher([
'serial_voucher' => $this->data['serial_voucher'],
'product_id' => $product->id,
'created_by' => Auth::id(),
]);
}
return null;
}
3 replies