repository = $form; parent::__construct(); } /** * Show form's list. * * @param string $slug * * @return response */ protected function index() { $forms = $this->repository ->pushCriteria(app('Litepie\Repository\Criteria\RequestCriteria')) ->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->response->title(trans('$newpackage::$form.names')) ->view('$newpackage::public.form.index') ->data(compact('$forms')) ->output(); } /** * Show form's list based on a type. * * @param string $slug * * @return response */ protected function list($type = null) { $forms = $this->repository ->pushCriteria(app('Litepie\Repository\Criteria\RequestCriteria')) ->scopeQuery(function($query){ return $query->orderBy('id','DESC'); })->paginate(); return $this->response->title(trans('$newpackage::$form.names')) ->view('$newpackage::public.form.index') ->data(compact('$forms')) ->output(); } /** * Show form. * * @param string $slug * * @return response */ protected function show($slug) { $form = $this->repository->scopeQuery(function($query) use ($slug) { return $query->orderBy('id','DESC') ->where('slug', $slug); })->first(['*']); return $this->response->title($$form->name . trans('$newpackage::$form.name')) ->view('$newpackage::public.form.show') ->data(compact('$form')) ->output(); } }