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


PHP Item::select方法代码示例

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


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

示例1: items

 public function items()
 {
     $fileName = "Items Mastefile.csv";
     $writer = WriterFactory::create(Type::CSV);
     // for CSV files
     $writer->openToBrowser($fileName);
     // stream data directly to the browser
     $writer->addRow(array('Category Long Description', 'Category Short Description', 'SKU Code', 'Barcode', 'Item Short Description', 'Item Long Description', 'Conversion', 'Sub Category', 'Brand', 'Division', 'LPBT/Cond Value (PC)', 'Status'));
     $items = Item::select(\DB::raw('category_long, category, sku_code, barcode, description, 
         description_long, conversion, sub_category, brand, division, lpbt, items.active'))->join('categories', 'categories.id', '=', 'items.category_id')->join('sub_categories', 'sub_categories.id', '=', 'items.sub_category_id')->join('brands', 'brands.id', '=', 'items.brand_id')->join('divisions', 'divisions.id', '=', 'items.division_id')->get();
     $pluckdata = [];
     foreach ($items as $item) {
         $data[0] = $item->category_long;
         $data[1] = $item->category;
         $data[2] = $item->sku_code;
         $data[3] = $item->barcode;
         $data[4] = $item->description;
         $data[5] = $item->description_long;
         $data[6] = $item->conversion;
         $data[7] = $item->sub_category;
         $data[8] = $item->brand;
         $data[9] = $item->division;
         $data[10] = $item->lpbt;
         if ($item->active == '1') {
             $data[11] = 'Active';
         } else {
             $data[11] = 'In-active';
         }
         $pluckdata[] = $data;
     }
     $writer->addRows($pluckdata);
     // add multiple rows at a time
     $writer->close();
 }
开发者ID:renciebautista,项目名称:pcount2,代码行数:34,代码来源:ExportController.php

示例2: item_data

 public function item_data()
 {
     \DB::statement(\DB::raw('set @rownum=0'));
     $items = Item::select([\DB::raw('@rownum  := @rownum  + 1 AS rownum'), 'id', 'name']);
     return Datatables::of($items)->addColumn('action', function ($item) {
         return '<a href="./item/edit/' . $item->id . '" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>';
     })->make(true);
 }
开发者ID:thesaputra,项目名称:xyz-prx,代码行数:8,代码来源:ItemController.php

示例3: itemDetails

 /**
  * Fetch item details
  * If item_id is provided then details of only that item will be fetched
  * Else complete list will be retrieved
  *
  * @param null $item_id
  * @return object
  */
 public function itemDetails($item_id = NULL)
 {
     $item = Item::select('id', 'name', 'unit', 'rate', 'tax_id', 'description');
     if (!is_null($item_id)) {
         $item = $item->where('id', $item_id)->first();
     }
     return $item;
 }
开发者ID:sabihk,项目名称:soft,代码行数:16,代码来源:Item.php

示例4: autocomplete

 /**
  * Get matching items for autocompletion stuff
  *
  * @return array
  */
 public function autocomplete()
 {
     // Request data
     $query = $this->getInput('q');
     $language = $this->requestedLanguage();
     // No search for too short queries
     if (strlen($query) < 3) {
         return $this->apiResponse([], 2678400);
     }
     // Return the items that match the search query
     $matching = Item::select(['id', 'name_' . $language . ' AS name', 'image', 'rarity', 'level'])->where('name_' . $language, 'LIKE', '%' . $query . '%')->take(25)->get()->toArray();
     return $this->apiResponse($matching, 86400);
 }
开发者ID:RLHawk1,项目名称:gw2-api,代码行数:18,代码来源:ItemsController.php

示例5: getItemData

 public function getItemData()
 {
     $obj = new Item();
     $cols = $obj->current_columns();
     $item = Item::select(array('items.id', 'items.measure', 'vendors.name', 'items.date', 'items.container', 'items.receive'))->join('vendors', 'items.vendor_id', '=', 'vendors.id');
     return Datatables::of($item)->make(true);
 }
开发者ID:kevin-ngn,项目名称:warehouse.demo,代码行数:7,代码来源:ItemController.php

示例6: resolveItemsBySkinName

 private function resolveItemsBySkinName($skins)
 {
     $skinName = function ($skin) {
         return $skin . ' Skin';
     };
     // Grab the names of the remaining skins
     $names = array_map($skinName, array_pluck($skins, 'name'));
     // Try to find them
     $name_items = Item::select('name_en', DB::raw("GROUP_CONCAT(DISTINCT id SEPARATOR ',') AS items"))->whereIn('name_en', $names)->groupBy('name_en')->lists('items', 'name_en');
     foreach ($skins as &$skin) {
         $name = $skinName($skin['name']);
         if (!isset($name_items[$name])) {
             continue;
         }
         $skin_items = explode(',', $name_items[$name]);
         if (isset($skin['items'])) {
             $skin['items'] = array_merge($skin['items'], $skin_items);
         } else {
             $skin['items'] = $skin_items;
         }
     }
     $this->info('Resolved ' . count($name_items) . ' skins by skin name lookup...');
     return $skins;
 }
开发者ID:RLHawk1,项目名称:gw2-api,代码行数:24,代码来源:UpdateWardrobe.php


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