offerLetterRepository = $offerLetterRepository; $this->departmentRepository = $departmentRepository; $this->designationRepository = $designationRepository; $this->workShiftRepository = $workShiftRepository; $this->employeeRepository = $employeeRepository; $this->jobPostRepository = $jobPostRepository; $this->jobApplicationRepository = $jobApplicationRepository; } /** * Display a listing of the resource. */ public function index() { $data['title'] = 'OfferLetter Lists'; $data['offerLetterLists'] = $this->offerLetterRepository->findAll(); return view('recruit::offerletters.index', $data); } /** * Show the form for creating a new resource. */ public function create() { $data['title'] = 'Create OfferLetter'; $data['editable'] = false; $data['workShiftLists'] = $this->workShiftRepository->pluck(); $data['designationLists'] = $this->designationRepository->pluck(); $data['departmentLists'] = $this->departmentRepository->pluck(); $data['employeeLists'] = $this->employeeRepository->pluck(); $data['jobPostLists'] = $this->jobPostRepository->pluck(); $data['jobApplicationLists'] = $this->jobApplicationRepository->pluck(); $data['employeeLists'] = $this->employeeRepository->pluck(); return view('recruit::offerletters.create', $data); } /** * Store a newly created resource in storage. */ public function store(Request $request): RedirectResponse { $request->merge([ 'createdBy' => auth()->user()->id, ]); try { $this->offerLetterRepository->create($request->all()); toastr()->success('OfferLetter Created Succesfully'); } catch (\Throwable $th) { toastr()->error($th->getMessage()); } return redirect()->route('offerLetter.index'); } /** * Show the specified resource. */ public function show($id) { return view('recruit::offerletters.show'); } /** * Show the form for editing the specified resource. */ public function edit($id) { $data['title'] = 'Edit OfferLetter'; $data['editable'] = true; $data['workShiftLists'] = $this->workShiftRepository->pluck(); $data['designationLists'] = $this->designationRepository->pluck(); $data['departmentLists'] = $this->departmentRepository->pluck(); $data['employeeLists'] = $this->employeeRepository->pluck(); $data['offerLetter'] = $this->offerLetterRepository->getOfferLetterById($id); return view('recruit::offerletters.edit', $data); } /** * Update the specified resource in storage. */ public function update(Request $request, $id): RedirectResponse { $inputData = $request->all(); try { $this->offerLetterRepository->update($id, $inputData); toastr()->success('InterviewSchecule Updated Succesfully'); } catch (\Throwable $th) { toastr()->error($th->getMessage()); } return redirect()->route('offerLetter.index'); } /** * Remove the specified resource from storage. */ public function destroy($id) { try { $this->offerLetterRepository->delete($id); toastr()->success('OfferLetter Deleted Succesfully'); } catch (\Throwable $th) { //throw $th; toastr()->error($th->getMessage()); } } }