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