fix bug cannot approve

This commit is contained in:
Jagad R R
2025-01-10 13:16:17 +07:00
parent 210203f964
commit 0dec9277f7
3 changed files with 18 additions and 3 deletions
@@ -266,10 +266,15 @@ class FormOtherController extends Controller
$this->checkAuthorization(auth()->user(), ['approval.approve']);
$request->validate([
'total' => 'required|numeric|min:1|max:' . BudgetHelper::getAvailableBudget(),
'total' => 'required',
]);
$form = FormOthers::findOrfail($id);
if($form->total > BudgetHelper::getAvailableBudget()) {
session()->flash('error', 'The total nominal exceeds the available budget.');
return redirect()->back();
}
$form->update([
'approved_at' => now(),
'approved_by' => auth()->user()->id,