Esempio n. 1
0
 /**
  * Get product data.
  *
  * @param int $productId
  * @param string $productCode
  * @param GetProductRequest $request
  * @param AjaxResponse $response
  * @return mixed
  */
 public function get($productId, $productCode, GetProductRequest $request, AjaxResponse $response)
 {
     // Make sure product exists
     if (!ApplicationProduct::where('code', $productCode)->where('id', $productId)->count()) {
         $response->setFailMessage(trans('common.general_error'));
         return response($response->get())->header('Content-Type', 'application/json');
     }
     $response->setSuccessMessage(trans('common.success'));
     $response->addExtraFields(['product' => ProductsManagerHelper::productDetails($productCode, $productId)]);
     return response($response->get())->header('Content-Type', 'application/json');
 }
Esempio n. 2
0
 /**
  * Return application products that match given product code or name.
  *
  * @param SearchProductsRequest $request
  * @return mixed
  */
 public function search(SearchProductsRequest $request)
 {
     return ProductsManagerHelper::searchedBillsPagination($request->get('term'), $request->get('page'));
 }