当前位置: 首页>>代码示例>>PHP>>正文


PHP AttributeGroup::with方法代码示例

本文整理汇总了PHP中AttributeGroup::with方法的典型用法代码示例。如果您正苦于以下问题:PHP AttributeGroup::with方法的具体用法?PHP AttributeGroup::with怎么用?PHP AttributeGroup::with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AttributeGroup的用法示例。


在下文中一共展示了AttributeGroup::with方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_index

 public function get_index($cat = '', $alias = '')
 {
     //Filtering the Attribute groups for product specific
     if (empty($alias)) {
     }
     $prod = Product::with(array('getCategory', 'getCategory.getDescriptions'))->where('alias', '=', $cat)->first();
     $cat = $prod->getCategory[0]->getDescriptions->alias;
     $alias = $prod->alias;
     $category_id = CategoryDescription::with('getCategory')->where('alias', '=', $cat)->only('id');
     $result = Category::with(array("getDescriptions", "getTopCat", "getTopCat.getDescriptions", "getProducts" => function ($query) use($alias) {
         $query->where('alias', '=', $alias);
     }, "getProducts.getBrand", "getProducts.getImages", "getProducts.getDetail", "getProducts.getTax", "getProducts.getDiscount", "getProducts.getAttributes", "getProducts.getShipment", "getAttributeListing", "getAttributeListing.getTopGroup"))->where('id', '=', $category_id)->first();
     Title::put($result->getProducts[0]->getDetail->name);
     /*Get attributes*/
     $topGroups = array();
     foreach ($result->getAttributeListing as $item) {
         array_push($topGroups, $item->getTopGroup->id);
     }
     $topGroups = array_unique($topGroups);
     $groups = array();
     foreach ($result->getAttributeListing as $item) {
         array_push($groups, $item->id);
     }
     $groups = array_unique($groups);
     $belongedGroups = array();
     foreach ($result->getProducts[0]->getAttributes as $item) {
         array_push($belongedGroups, $item->id);
     }
     $attrs = AttributeGroup::with(array('getParentGroup' => function ($query) use($groups) {
         $query->order_by('sort_order', 'desc');
         $query->where_in('id', $groups);
     }, 'getParentGroup.getAttributes' => function ($query) use($belongedGroups) {
         $query->where_in('id', $belongedGroups);
     }))->where_in('id', $topGroups)->get();
     return View::make('products.index')->with('product', $result)->with('attrs', $attrs);
 }
开发者ID:TahsinGokalp,项目名称:L3-Eticaret,代码行数:36,代码来源:product.php

示例2: post_productAttribute

 public function post_productAttribute()
 {
     $data = Input::all();
     //	$attrsTop = AttributeGroup::with(array('getTopGroup','getAttributes'))->where('id','=',$data['id'])->first();
     $result = Category::with(array("getAttributeListing", "getAttributeListing.getTopGroup"))->where('id', '=', $data['id'])->first();
     $topGroups = array();
     foreach ($result->getAttributeListing as $item) {
         array_push($topGroups, $item->getTopGroup->id);
     }
     $topGroups = array_unique($topGroups);
     $belongedGroups = array();
     foreach ($result->getAttributeListing as $item) {
         array_push($belongedGroups, $item->id);
     }
     $belongedGroups = array_unique($belongedGroups);
     /*Now we held only top groups($tmp) and Attributes groups($belongedGroups) only related to a category*/
     $attrs = AttributeGroup::with(array('getParentGroup' => function ($query) use($belongedGroups) {
         $query->order_by('sort_order', 'ASC');
         $query->where_in('id', $belongedGroups);
     }, 'getParentGroup.getAttributes'))->where_in('id', $topGroups)->get();
     return Response::eloquent($attrs);
 }
开发者ID:TahsinGokalp,项目名称:L3-Eticaret,代码行数:22,代码来源:admin.php


注:本文中的AttributeGroup::with方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。