pluck('id')->first(); $sundries_cost_of_good_account_id = \Streamline\Models\ChartOfAccount::where('id', 5)->pluck('id')->first(); $drugs_inventory_asset_account_id = \Streamline\Models\ChartOfAccount::where('id', 18)->pluck('id')->first(); $sundries_inventory_asset_account_id = \Streamline\Models\ChartOfAccount::where('id', 24)->pluck('id')->first(); foreach ($drugs as $drug) { \Streamline\Models\Drug::where('id', $drug->id)->update([ 'cost_of_goods_account' => $drugs_cost_of_good_account_id, 'inventory_account' => $drugs_inventory_asset_account_id ]); } foreach ($sundries as $sundry) { \Streamline\Models\Sundry::where('id', $sundry->id)->update([ 'cost_of_goods_account' => $sundries_cost_of_good_account_id, 'inventory_account' => $sundries_inventory_asset_account_id ]); } foreach ($treatment_deposits as $treatment) { \Streamline\Models\TreatmentDeposits::where('id', $treatment->id)->update([ 'cost_of_goods_account' => $drugs_cost_of_good_account_id, 'inventory_account' => $drugs_inventory_asset_account_id ]); } foreach ($sundry_deposits as $sundry) { \Streamline\Models\TreatmentDeposits::where('id', $treatment->id)->update([ 'cost_of_goods_account' => $sundries_cost_of_good_account_id, 'inventory_account' => $sundries_inventory_asset_account_id ]); } } }