本文整理汇总了PHP中Tags::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Tags::where方法的具体用法?PHP Tags::where怎么用?PHP Tags::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tags
的用法示例。
在下文中一共展示了Tags::where方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postRemoveTag
public function postRemoveTag($type, $id)
{
$row = Tags::where('tag', '=', Input::get('tag'))->first();
DB::table('tags_relate')->where('tags_id', '=', $row->tags_id)->where($type, '=', $id)->delete();
$this->audit('Delete');
}
示例2: searching
public function searching($term)
{
$condition = array("New" => 1, "Perfect" => 2, "Good" => 3, "Blemist" => 4);
$cond_prod_ids = array();
$product_ids = array();
$pro_ids = array();
$brand_prod_ids = array();
$cat_prod_ids = array();
$tag_prod_ids = array();
//Search by product condition
if (in_array($term, $condition)) {
$cond_prod_ids = Product::where("condition", "=", $condition[$term])->lists('products_id');
}
//Search by product attribute name
$product_values_ids = ProductsOptionsValues::where('products_options_values_name', 'LIKE', '%' . $term . '%')->lists('products_options_values_id');
if ($product_values_ids) {
$product_ids = DB::table('bn_products_attributes')->whereIn('options_values_id', $product_values_ids)->lists('products_id');
}
//Search by product name or description
$pro_ids = ProductsDescription::where('products_name', 'LIKE', '%' . $term . '%')->orWhere('products_description', 'LIKE', '%' . $term . '%')->lists('products_id');
//Search by product brand
$brand_ids = Brands::where('brand_name', 'LIKE', '%' . $term . '%')->lists('brands_id');
if ($brand_ids) {
$brand_prod_ids = Product::whereIn("brand", $brand_ids)->lists('products_id');
}
//Search product by category
$cat_ids = Categories::where('title', 'LIKE', '%' . $term . '%')->lists('categories_id');
if ($cat_ids) {
$cat_prod_ids = DB::table('bn_products_to_categories')->whereIn('categories_id', $cat_ids)->lists('products_id');
}
//Search product by tags
$tag_ids = Tags::where('title', 'LIKE', '%' . $term . '%')->lists('tags_id');
if ($tag_ids) {
$tag_prod_ids = DB::table('bn_products_to_tags')->whereIn('tags_id', $tag_ids)->lists('products_id');
}
$result_prod_ids = array_merge($product_ids, $cond_prod_ids, $pro_ids, $brand_prod_ids, $cat_prod_ids, $tag_prod_ids);
$products = Product::whereIn('products_id', $result_prod_ids)->where('products_status', '1')->paginate(15);
//->get();
if ($products) {
$products = $this->product_add_detail($products);
return $this->response(array('statusCode' => 100, 'statusDescription' => 'Success', 'products' => json_decode($products->toJson(), true)));
} else {
return $this->response(array('statusCode' => 400, 'statusDescription' => 'Not Found'));
}
}