foreach ($rows as $row) {
$source = Inventory_sources::where('code', $row['inventory_source_code'])->first();
$source_id=$source->id;
$product = Product::create([
'type' => $row['type'],
'sku' => $row['sku'],
'attribute_family_id' => $row['attribute_family'],
]);
product_flat::create([
'product_id' => $product->id,
'sku' => $row['sku'],
'name' => $row['name'],
'price' => $row['price'],
'status' => $row['status'],
]);
product_inventories::create([
'inventory_source_id' => $source_id,
'product_id' => $product->id,
'qty' => $row['qty'],
]);
}
error - Trying to get property 'id' of non-object I try dd() its show the output. how to resolve this issue