form = ZinginternalForm::setAttributes()->toArray(); $this->modules = $this->modules(config('litecms.eatery.modules'), 'eatery', guard_url('eatery')); $this->repository = $zinginternal; } /** * Display a list of zinginternal. * * @return Response */ public function index(ZinginternalRequest $request) { $pageLimit = $request->input('pageLimit', config('database.pagination.limit')); $data = $this->repository ->pushFilter(RequestFilter::class) ->pushFilter(ZinginternalResourceFilter::class) ->setPresenter(ZinginternalListPresenter::class) ->simplePaginate($pageLimit) // ->withQueryString() ->toArray(); extract($data); $form = $this->form; $modules = $this->modules; return $this->response->setMetaTitle(trans('eatery::zinginternal.names')) ->view('eatery::zinginternal.index') ->data(compact('data', 'meta', 'links', 'modules', 'form')) ->output(); } /** * Display zinginternal. * * @param Request $request * @param Model $zinginternal * * @return Response */ public function show(ZinginternalRequest $request, ZinginternalRepositoryInterface $repository) { $form = $this->form; $modules = $this->modules; $data = $repository->toArray(); return $this->response ->setMetaTitle(trans('app.view') . ' ' . trans('eatery::zinginternal.name')) ->data(compact('data', 'form', 'modules', 'form')) ->view('eatery::zinginternal.show') ->output(); } /** * Show the form for creating a new zinginternal. * * @param Request $request *x * @return Response */ public function create(ZinginternalRequest $request, ZinginternalRepositoryInterface $repository) { $form = $this->form; $modules = $this->modules; $data = $repository->toArray(); return $this->response->setMetaTitle(trans('app.new') . ' ' . trans('eatery::zinginternal.name')) ->view('eatery::zinginternal.create') ->data(compact('data', 'form', 'modules')) ->output(); } /** * Create new zinginternal. * * @param Request $request * * @return Response */ public function store(ZinginternalRequest $request, ZinginternalRepositoryInterface $repository) { try { $attributes = $request->all(); $attributes['user_id'] = user_id(); $attributes['user_type'] = user_type(); $repository->create($attributes); $data = $repository->toArray(); return $this->response->message(trans('messages.success.created', ['Module' => trans('eatery::zinginternal.name')])) ->code(204) ->data(compact('data')) ->status('success') ->url(guard_url('eatery/zinginternal/' . $data['id'])) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->code(400) ->status('error') ->url(guard_url('/eatery/zinginternal')) ->redirect(); } } /** * Show zinginternal for editing. * * @param Request $request * @param Model $zinginternal * * @return Response */ public function edit(ZinginternalRequest $request, ZinginternalRepositoryInterface $repository) { $form = $this->form; $modules = $this->modules; $data = $repository->toArray(); return $this->response->setMetaTitle(trans('app.edit') . ' ' . trans('eatery::zinginternal.name')) ->view('eatery::zinginternal.edit') ->data(compact('data', 'form', 'modules')) ->output(); } /** * Update the zinginternal. * * @param Request $request * @param Model $zinginternal * * @return Response */ public function update(ZinginternalRequest $request, ZinginternalRepositoryInterface $repository) { try { $attributes = $request->all(); $repository->update($attributes); $data = $repository->toArray(); return $this->response->message(trans('messages.success.updated', ['Module' => trans('eatery::zinginternal.name')])) ->code(204) ->status('success') ->data(compact('data')) ->url(guard_url('eatery/zinginternal/' . $data['id'])) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->code(400) ->status('error') ->url(guard_url('eatery/zinginternal/' . $repository->getRouteKey())) ->redirect(); } } /** * Remove the zinginternal. * * @param Model $zinginternal * * @return Response */ public function destroy(ZinginternalRequest $request, ZinginternalRepositoryInterface $repository) { try { $repository->delete(); $data = $repository->toArray(); return $this->response->message(trans('messages.success.deleted', ['Module' => trans('eatery::zinginternal.name')])) ->code(202) ->status('success') ->data(compact('data')) ->url(guard_url('eatery/zinginternal/0')) ->redirect(); } catch (Exception $e) { return $this->response->message($e->getMessage()) ->code(400) ->status('error') ->url(guard_url('eatery/zinginternal/' . $repository->getRouteKey())) ->redirect(); } } }