gwpService = $gwpService; } public static function middleware(): array { return [ //new Middleware('permission:/setting/gwp'), ]; } public function index() { $data['ghgs'] = ReferenceGhg::rowActive()->orderByRowNum()->get(); $data['ars'] = ReferenceAr::rowActive()->orderByRowNum()->get(); $data['gwpMatrix'] = $this->gwpService->getMatrix(); $data['route'] = $this->route; $data['title'] = $this->title; return view($this->template.'.index',$data); } public function store(Request $request) { $request->validate([ 'gwp' => 'required|array', ]); try { $this->gwpService->save($request->all()); return redirect()->route($this->route.'.index')->with('success', 'GWP berhasil disimpan.'); } catch (\Exception $e) { return back()->withErrors(['error' => 'GWP gagal disimpan. Silakan coba lagi. Error: ' . $e->getMessage()]); } } }