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