1
0
forked from poc/pds

production_order null exception solved

This commit is contained in:
dhanabalan
2025-04-23 21:10:51 +05:30
parent 3d744e8183
commit a4471c3c3b

View File

@@ -302,9 +302,10 @@ class ProductionQuantityResource extends Resource
return $get('item_code');
})
->default(function () {
// Get the latest 'item_id' foreign key from 'production_quantities' table
$latestProductionOrder = ProductionQuantity::latest()->first()->production_order;
return $latestProductionOrder ?? null;
// $latestProductionOrder = ProductionQuantity::latest()->first()->production_order;
// return $latestProductionOrder ?? null;
$latestProduction = ProductionQuantity::latest()->first();
return $latestProduction ? $latestProduction->production_order : null;
}),
Forms\Components\TextInput::make('item_code')
->label('Item Code')