added check if expense is closed, user cannot edit
This commit is contained in:
@@ -136,6 +136,11 @@ class FormVehicleController extends Controller
|
||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.edit']);
|
||||
|
||||
$form = FormVehicleRunningCost::findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
return view('backend.pages.forms.vehicle.edit', [
|
||||
'form' => $form
|
||||
]);
|
||||
@@ -159,6 +164,11 @@ class FormVehicleController extends Controller
|
||||
]);
|
||||
|
||||
$form = FormVehicleRunningCost::findOrfail($id);
|
||||
if($form->status == 'Closed') {
|
||||
session()->flash('error', 'Form has been closed, you cannot edit it.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', $form->user_id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('name', 'Vehicle Running Cost')->first();
|
||||
|
||||
Reference in New Issue
Block a user