paymentModeRepository = $paymentModeRepository; } public function index() { $data['title'] = 'Payment Modes'; $data['paymentModes'] = $this->paymentModeRepository->findAll(); return view('order::paymentMode.index', $data); } public function create() { $data['title'] = 'Create Payment Mode'; $data['status'] = PaymentMode::STATUS; return view('order::paymentMode.create', $data); } public function store(Request $request): RedirectResponse { $request->request->add(['slug' => slugify($request->title)]); $inputData = $request->all(); $this->paymentModeRepository->create($inputData); toastr()->success('Payment Mode Created Successfully'); return redirect()->route('paymentMode.index'); } public function show($id) { $data['title'] = 'Show Payment Mode'; $data['status'] = PaymentMode::STATUS; $data['paymentMode'] = $this->paymentModeRepository->getPaymentModeById($id); return view('order::paymentMode.show', $data); } public function edit($id) { $data['title'] = 'Edit Payment Mode'; $data['status'] = PaymentMode::STATUS; $data['paymentMode'] = $this->paymentModeRepository->getPaymentModeById($id); return view('order::paymentMode.edit', $data); } public function update(Request $request, $id): RedirectResponse { $inputData = $request->except(['_method', '_token']); $this->paymentModeRepository->update($id, $inputData); return redirect()->route('paymentMode.index'); } public function destroy($id) { try { $stock = $this->paymentModeRepository->getPaymentModeById($id); $stock->delete(); toastr()->success('Payment Mode Deleted Successfully'); } catch (\Throwable $th) { toastr()->error($th->getMessage()); } return response()->json(['status' => true, 'message' => 'Payment Mode Deleted Successfully']); } }