Update BudgetControlController.php
This commit is contained in:
@@ -124,17 +124,22 @@ class BudgetControlController extends Controller
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$cabang_id = Admin::find($validated['receiver_id'])->getMyCabangAndRegionId()['cabang'];
|
$cabang_id = Admin::find($validated['receiver_id'])->getMyCabangAndRegionId()['cabang'];
|
||||||
BudgetControl::updateOrCreate(['cabang_id' => $cabang_id],
|
$periode = [
|
||||||
[
|
|
||||||
'sender_id' => auth()->user()->id,
|
|
||||||
'receiver_id' => $validated['receiver_id'],
|
|
||||||
'periode_month' => $validated['periode_month'],
|
'periode_month' => $validated['periode_month'],
|
||||||
'periode_year' => $validated['periode_year'],
|
'periode_year' => $validated['periode_year'],
|
||||||
|
];
|
||||||
|
|
||||||
|
BudgetControl::updateOrCreate(
|
||||||
|
array_merge(['cabang_id' => $cabang_id], $periode),
|
||||||
|
array_merge($periode, [
|
||||||
|
'sender_id' => auth()->user()->id,
|
||||||
|
'receiver_id' => $validated['receiver_id'],
|
||||||
'amount' => $validated['amount'],
|
'amount' => $validated['amount'],
|
||||||
'remarks' => $validated['remarks'],
|
'remarks' => $validated['remarks'],
|
||||||
'closing_at' => null,
|
'closing_at' => null,
|
||||||
'status' => 'Assigned',
|
'status' => 'Assigned',
|
||||||
]);
|
])
|
||||||
|
);
|
||||||
|
|
||||||
BudgetControlLog::create([
|
BudgetControlLog::create([
|
||||||
'cabang_id' => $cabang_id,
|
'cabang_id' => $cabang_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user