repository = $product_custom_searchresult; $this->repository ->pushCriteria(\Litepie\Repository\Criteria\RequestCriteria::class) ->pushCriteria(\Litecms\Productsearch\Repositories\Criteria\ProductCustomSearchresultResourceCriteria::class); } /** * Display a list of product_custom_searchresult. * * @return Response */ public function index(ProductCustomSearchresultRequest $request) { return $this->repository ->setPresenter(\Litecms\Productsearch\Repositories\Presenter\ProductCustomSearchresultPresenter::class) ->paginate(); } /** * Display product_custom_searchresult. * * @param Request $request * @param Model $product_custom_searchresult * * @return Response */ public function show(ProductCustomSearchresultRequest $request, ProductCustomSearchresult $product_custom_searchresult) { return $product_custom_searchresult->setPresenter(\Litecms\Productsearch\Repositories\Presenter\ProductCustomSearchresultListPresenter::class); ; } /** * Create new product_custom_searchresult. * * @param Request $request * * @return Response */ public function store(ProductCustomSearchresultRequest $request) { try { $data = $request->all(); $data['user_id'] = user_id(); $data['user_type'] = user_type(); $data = $this->repository->create($data); $message = trans('messages.success.created', ['Module' => trans('productsearch::product_custom_searchresult.name')]); $code = 204; $status = 'success'; $url = guard_url('productsearch/product_custom_searchresult/' . $product_custom_searchresult->getRouteKey()); } catch (Exception $e) { $message = $e->getMessage(); $code = 400; $status = 'error'; $url = guard_url('productsearch/product_custom_searchresult'); } return compact('data', 'message', 'code', 'status', 'url'); } /** * Update the product_custom_searchresult. * * @param Request $request * @param Model $product_custom_searchresult * * @return Response */ public function update(ProductCustomSearchresultRequest $request, ProductCustomSearchresult $product_custom_searchresult) { try { $data = $request->all(); $product_custom_searchresult->update($data); $message = trans('messages.success.updated', ['Module' => trans('productsearch::product_custom_searchresult.name')]); $code = 204; $status = 'success'; $url = guard_url('productsearch/product_custom_searchresult/' . $product_custom_searchresult->getRouteKey()); } catch (Exception $e) { $message = $e->getMessage(); $code = 400; $status = 'error'; $url = guard_url('productsearch/product_custom_searchresult/' . $product_custom_searchresult->getRouteKey()); } return compact('data', 'message', 'code', 'status', 'url'); } /** * Remove the product_custom_searchresult. * * @param Model $product_custom_searchresult * * @return Response */ public function destroy(ProductCustomSearchresultRequest $request, ProductCustomSearchresult $product_custom_searchresult) { try { $product_custom_searchresult->delete(); $message = trans('messages.success.deleted', ['Module' => trans('productsearch::product_custom_searchresult.name')]); $code = 202; $status = 'success'; $url = guard_url('productsearch/product_custom_searchresult/0'); } catch (Exception $e) { $message = $e->getMessage(); $code = 400; $status = 'error'; $url = guard_url('productsearch/product_custom_searchresult/' . $product_custom_searchresult->getRouteKey()); } return compact('message', 'code', 'status', 'url'); } /** * Return the form elements as json. * * @param String $element * * @return json */ public function form($element = 'fields') { $form = new Form(); return $form->form($element, true); } }