model = $job; $this->model->setUserFilter(); parent::__construct(); } /** * Display a listing of the resource. * * @return Response */ public function index(JobUserRequest $request) { $jobs = $this->model->all(); $this->theme->prependTitle(trans('career::job.names').' :: '); return $this->theme->of('career::user.job.index', compact('jobs'))->render(); } /** * Display the specified resource. * * @param Request $request * @param int $id * * @return Response */ public function show(JobUserRequest $request, $role, $id) { $job = $this->model->find($id); return $this->theme->of('career::user.job.show', compact('job'))->render(); } /** * Show the form for creating a new resource. * * @param Request $request * * @return Response */ public function create(JobUserRequest $request) { $job = $this->model->findOrNew(0); Former::populate($job); return $this->theme->of('career::user.job.create', compact('job'))->render(); } /** * Display the specified resource. * * @param Request $request * * @return Response */ public function store(JobUserRequest $request) { try { $attributes = $request->all(); $job = $this->model->create($attributes); return $this->success(trans('messages.success.created', ['Module' => trans('career::job.name')])); } catch (Exception $e) { return $this->error($e->getMessage()); } } /** * Show the form for editing the specified resource. * * @param Request $request * @param int $id * * @return Response */ public function edit(JobUserRequest $request, $role, $id) { $job = $this->model->find($id); Former::populate($job); return $this->theme->of('career::user.job.edit', compact('job'))->render(); } /** * Update the specified resource. * * @param Request $request * @param int $id * * @return Response */ public function update(JobUserRequest $request, $role, $id) { try { $attributes = $request->all(); $job = $this->model->update($attributes, $id); return $this->success(trans('messages.success.updated', ['Module' => trans('career::job.name')])); } catch (Exception $e) { return $this->error($e->getMessage()); } } /** * Remove the specified resource. * * @param int $id * * @return Response */ public function destroy(JobUserRequest $request, $role, $id) { try { $this->model->delete($id); return $this->success(trans('message.success.deleted', ['Module' => trans('career::job.name')]), 200); } catch (Exception $e) { return $this->error($e->getMessage()); } } }