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