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