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