Esempio n. 1
0
 /**
  * @param $searchString
  * @param int $limit
  * @param int $page
  * @param bool $options
  * @return bool|\Illuminate\Pagination\LengthAwarePaginator
  */
 public function searchProduct($searchString, $limit = KACANA_PRODUCT_ITEM_PER_TAG, $page = 1, $options = false, $userId)
 {
     $productModel = new productModel();
     $userProductLike = new userProductLikeModel();
     $products = $productModel->searchProduct($searchString, $limit, $page, $options);
     foreach ($products as &$product) {
         $this->formatProductPropertiesWhenSearch($product);
         $product->isLiked = $userProductLike->getItem($userId, $product->id) ? true : false;
     }
     return $products;
 }