promotionDemotionRepository = $promotionDemotionRepository; } /** * Display a listing of the resource. */ public function index() { $data['title'] = "Promotion/ Demotion Lists"; $data['promotionDemotionLists'] = $this->promotionDemotionRepository->findAll(); return view('admin::promotiondemotions.index', $data); } /** * Show the form for creating a new resource. */ public function create() { $data['editable'] = false; $data['title'] = "Create Promotion/ Demotion"; return view('admin::promotiondemotions.create', $data); } /** * Store a newly created resource in storage. */ public function store(Request $request): RedirectResponse { $this->promotionDemotionRepository->create($request->all()); toastr()->success('Promotion/ Demotion Created Successfully'); return redirect()->route('promotionDemotion.index'); } /** * Show the specified resource. */ public function show($id) { return view('admin::promotiondemotions.show'); } /** * Show the form for editing the specified resource. */ public function edit($id) { $data['editable'] = false; $data['title'] = "Edit Promotion/ Demotion"; $data['promotionDemotion'] = $this->promotionDemotionRepository->getPromotionDemotionById($id); return view('admin::promotiondemotions.edit', $data); } /** * Update the specified resource in storage. */ public function update(Request $request, $id): RedirectResponse { $this->promotionDemotionRepository->update($id, $request->all()); toastr()->success('Promotion/ Demotion Updated Successfully'); return redirect()->route('promotionDemotion.index'); } /** * Remove the specified resource from storage. */ public function destroy($id) { $this->promotionDemotionRepository->delete($id); toastr()->success('Promotion/ Demotion Deleted Successfully'); return redirect()->route('promotionDemotion.index'); } }