employeeRepository = $employeeRepository; $this->trainerRepository = $trainerRepository; } public function index() { $data['title'] = 'Trainer Lists'; $data['trainerLists'] = $this->trainerRepository->findAll(); return view ('training::trainer.index', $data); } /** * Show the form for creating a new resource. */ public function create() { $data['title'] = 'Create Trainer'; $data['editable'] = false; return view('training::trainer.create', $data); } /** * Store a newly created resource in storage. */ public function store(Request $request): RedirectResponse { $this->trainerRepository->create($request->all()); toastr()->success('Trainer Created Successfully'); return redirect()->route('trainer.index'); } /** * Show the specified resource. */ public function show($id) { $data['title'] = 'Training Details'; $data['item'] = $this->trainerRepository->getTrainerById($id); return view('training::trainer.show', $data); } /** * Show the form for editing the specified resource. */ public function edit($id) { $data['title'] = 'Edit Leave'; $data['editable'] = true; $data['trainer'] = $this->trainerRepository->getTrainerById($id); return view('training::trainer.edit', $data); } /** * Update the specified resource in storage. */ public function update(Request $request, $id): RedirectResponse { $inputData = $request->all(); $this->trainerRepository->update($id, $inputData); toastr()->success('Trainer Updated Succesfully'); return redirect()->route('trainer.index'); } /** * Remove the specified resource from storage. */ public function destroy($id) { $this->trainerRepository->delete($id); toastr()->success('Trainer Deleted Succesfully'); } }