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


PHP Items::find方法代码示例

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


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

示例1: postItemLoad

 public function postItemLoad()
 {
     if (Request::ajax()) {
         $id = Input::get('id');
         $art = Items::find($id);
         $a = new stdClass();
         $a->id = $art->id;
         $a->item_nomb = $art->item_nomb;
         $a->item_desc = $art->item_desc;
         $a->item_cod = $art->item_cod;
         $a->item_precio = $art->item_precio;
         $currency = " USD.";
         $a->tallas = array();
         $misc = Misc::where('item_id', '=', $art->id)->get();
         $aux2 = array();
         $aux3 = array();
         $i = 0;
         $j = 0;
         $k = 0;
         $images = array();
         foreach ($misc as $m) {
             $aux2[$j] = $m->item_talla;
             $auxMisc = new stdClass();
             $auxMisc->id = $m->id;
             $auxMisc->ta = $m->item_talla;
             $aux3[$j] = $auxMisc;
             $j++;
             $x = Images::where('misc_id', '=', $m->id)->where('deleted', '=', 0)->get(array('id', 'misc_id', 'image', 'order'));
             foreach ($x as $y) {
                 $aux = new stdClass();
                 $aux->id = $y->id;
                 $aux->misc_id = $y->misc_id;
                 $aux->image = $y->image;
                 $aux->order = $y->order;
                 $images[$k] = $aux;
                 $k++;
             }
         }
         for ($i = 0; $i < count($images); $i++) {
             for ($j = 0; $j < count($images) - 1; $j++) {
                 if ($images[$j]->order > $images[$j + 1]->order) {
                     $bub = new stdClass();
                     $bub = $images[$j + 1];
                     $images[$j + 1] = $images[$j];
                     $images[$j] = $bub;
                 }
             }
         }
         $t = Misc::where('item_id', '=', $art->id)->groupBy('item_talla')->get(array('id'));
         $a->tallas = $t;
         $a->misc = $aux3;
         return Response::json(array('item' => $a, 'princ' => $images[0]->image, 'images' => $images, 'tallas' => $aux2, 'currency' => $currency));
     }
 }
开发者ID:bakuryuthem0,项目名称:nia,代码行数:54,代码来源:HomeController.php

示例2: getMyPurchase

 public function getMyPurchase($id)
 {
     $title = "Factura";
     $fac = Facturas::find($id);
     $user = User::find($fac->user_id);
     $aux = FacturaItem::where('factura_id', '=', $id)->get(array('item_id', 'item_qty'));
     $i = 0;
     foreach ($aux as $a) {
         $b = Items::find($a->item_id);
         $b->qty = $a->item_qty;
         $aux = Misc::where('item_id', '=', $a->item_id)->where('deleted', '=', 0)->first();
         $b->img = Images::where('misc_id', '=', $aux->id)->where('deleted', '=', 0)->first();
         $item[$i] = $b;
         $i++;
     }
     return View::make('user.factura')->with('fact', $item)->with('title', $title)->with('user', $user)->with('factura', $fac);
 }
开发者ID:bakuryuthem0,项目名称:nia,代码行数:17,代码来源:UserController.php

示例3: updateOrderDetails

 public function updateOrderDetails($id)
 {
     $response = array();
     $output = array();
     try {
         $order = new Orders();
         if (!Input::has('items')) {
             /*
              * User id has not been included here as it's not reuqired here, opposed to the create order request where it's mandtatory..
              * There shd be a single class which handles all this.
              */
             $response['response_code'] = ResponseCodes::$response_code['missing_param']['code'];
             $response['response_message'] = ResponseCodes::$response_code['missing_param']['response_message'];
             echo json_encode($response);
             die;
         }
         /*
          * Only the order item will be updated here. This is bcoz we have api to update the order payment and status.
          * So nothign else is left in the order table to be updated.
          */
         /*
          * While updating the items we assume that we are getting a json encoded data for the list of item with item id. 
          * like this [{"name":"shirt","quantity":"1","item_id":123},{"name":"saree","quantity":"3","item_id":"125"}]
          * with the product name and the quanity.Each item added belongs to a specific type which has a fixed price whc are intrenally mapped 
          */
         $list_of_items = json_decode(Input::get('items'), true);
         foreach ($list_of_items as $key => $item_data) {
             if (isset($item_data['item_id']) && !empty($item_data['item_id'])) {
                 $item = Items::find($item_data['item_id']);
                 $item->name = $item_data['name'];
                 $item->quantity = $item_data['quantity'];
                 // assuming the item type is correct.
                 $item->price = Price::$price_mapping[$item_data['name']] * $item_data['quantity'];
                 $item->save();
             }
         }
         // $output['order_id'] = $order->id;
         $response['response_code'] = ResponseCodes::$response_code['success']['code'];
         $response['response_message'] = ResponseCodes::$response_code['success']['response_message'];
         $response['output'] = $output;
         echo json_encode($response);
     } catch (Exception $e) {
         Log::error($e->getMessage());
         $response['response_code'] = ResponseCodes::$response_code['internal_server_error']['code'];
         $response['response_message'] = ResponseCodes::$response_code['internal_server_error']['response_message'];
         $response['output'] = $output;
         echo json_encode($response);
     }
 }
开发者ID:anil477,项目名称:Fab,代码行数:49,代码来源:OrdersController.php

示例4: getNewImgPos

 public function getNewImgPos($id)
 {
     $title = "Cambiar posición de las imagenes";
     $item = Items::find($id);
     $misc = Misc::where('item_id', '=', $item->id)->get(array('id'));
     $images = array();
     $j = 0;
     foreach ($misc as $m) {
         $x = Images::where('misc_id', '=', $m->id)->where('deleted', '=', 0)->get(array('id', 'misc_id', 'image', 'order'));
         foreach ($x as $y) {
             $aux = new stdClass();
             $aux->id = $y->id;
             $aux->misc_id = $y->misc_id;
             $aux->image = $y->image;
             $aux->order = $y->order;
             $images[$j] = $aux;
             $j++;
         }
     }
     for ($i = 0; $i < count($images); $i++) {
         for ($j = 0; $j < count($images) - 1; $j++) {
             if ($images[$j]->order > $images[$j + 1]->order) {
                 $bub = new stdClass();
                 $bub = $images[$j + 1];
                 $images[$j + 1] = $images[$j];
                 $images[$j] = $bub;
             }
         }
     }
     return View::make('admin.changeImagePos')->with('title', $title)->with('item', $images);
 }
开发者ID:bakuryuthem0,项目名称:nia,代码行数:31,代码来源:AdminController.php


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