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