added check if expense is closed, user cannot edit

This commit is contained in:
Jagad R R
2024-12-24 11:23:27 +07:00
parent 83307c47e8
commit f127c553df
5 changed files with 50 additions and 0 deletions
@@ -141,6 +141,11 @@ class FormUpCountryController extends Controller
$this->checkAuthorization(auth()->user(), ['forms.country.edit']);
$form = FormUpCountry::with('rayon')->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.upcountry.edit', [
'rayons' => Rayon::all(),
'form' => $form
@@ -166,6 +171,11 @@ class FormUpCountryController extends Controller
]);
$form = FormUpCountry::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', 'Up Country')->first();