本文整理汇总了PHP中ProductCategory::whereRaw方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductCategory::whereRaw方法的具体用法?PHP ProductCategory::whereRaw怎么用?PHP ProductCategory::whereRaw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProductCategory
的用法示例。
在下文中一共展示了ProductCategory::whereRaw方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _get_children
private function _get_children($category_id)
{
$children = array();
$cat_details = ProductCategory::whereRaw('parent_category_id = ?', array($category_id))->orderBy('category_left', 'ASC')->get(array('id', 'category_name', 'category_left', 'category_right', 'parent_category_id', 'category_level', 'display_order'));
if (count($cat_details) > 0) {
foreach ($cat_details as $cat) {
$children[$cat->id] = $cat;
}
}
return $children;
}
示例2: populateProductCategoryList
public function populateProductCategoryList($cat_id = '')
{
$catList = array();
$cat_id = $cat_id == '' || $cat_id == 0 ? $this->root_category_id : $cat_id;
$cat_details = ProductCategory::whereRaw('parent_category_id = ?', array($cat_id))->orderBy('category_left', 'ASC')->get(array('id', 'category_name', 'seo_category_name'));
if (count($cat_details) > 0) {
foreach ($cat_details as $catkey => $cat) {
$catList[$catkey] = $cat;
$count = isset($this->prod_cat_count_arr[$cat['id']]) ? $this->prod_cat_count_arr[$cat['id']] : 0;
$catList[$catkey]['cat_id'] = $cat['id'];
$catList[$catkey]['product_count'] = $count;
$catList[$catkey]['cat_link'] = $this->urlLink($cat['seo_category_name']);
}
}
return $catList;
}
示例3: deleteCategoryImage
public function deleteCategoryImage($id, $filename, $ext, $folder_name)
{
$data_arr = array('image_name' => '', 'image_ext' => '', 'image_height' => '', 'image_width' => '');
$affectedRows = ProductCategory::whereRaw('id = ?', array($id))->update($data_arr);
if ($affectedRows) {
$this->deleteImageFiles($filename, $ext, $folder_name);
return true;
}
return false;
}
示例4: isCategoryExists
public function isCategoryExists($category_id)
{
$category_count = ProductCategory::whereRaw('id = ?', array($category_id))->count();
return $category_count;
}