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


PHP Price::where方法代码示例

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


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

示例1: update

 public function update($id)
 {
     $priceType = PriceType::where('id', $id)->first();
     $priceType->name = Input::get('name');
     $priceType->save();
     $products = Product::get();
     //$default_cost=Input::get('price-1');
     //$type
     $prices = Price::where('price_type_id', $id)->get();
     foreach ($prices as $price) {
         $pri = Price::where('id', $price->id)->first();
         //if(Input::get('price-'.$pri->id))
         $price->cost = Input::get('price-' . $pri->id);
         //$price->price_type_id = $priceType->id;
         //$price->product_id = $product->id;
         $price->save();
     }
     Session::flash('message', "Precio actualizado con exito");
     return Redirect::to('precios');
 }
开发者ID:Vrian7ipx,项目名称:repocas,代码行数:20,代码来源:PriceController.php

示例2: checkoutPrice

 public function checkoutPrice()
 {
     $price = $this->quantity * Price::where('product_id', $this->item)->pluck($this->size);
     return $price;
 }
开发者ID:NocturnalWare,项目名称:managedotband,代码行数:5,代码来源:Cart.php

示例3: getEnrollments

 /**
  * @api {get} courses/enrolled/users/:id Get User's course history
  * @apiName Get User's course history
  * @apiGroup Enrollment
  *
  * @apiHeader (Header) {String} X_Authorization Authorization value.
  *
  * @apiParam {Number} idUser Mandatory  Users unique ID.
  *
  * @apiSuccessExample {json} Success-Response:
  *   HTTP/1.1 200 OK
  *   [
  *   {
  *    "membership_id": 1,
  *    "course_id": 26262,
  *    "name": "TurboChef: iSeries",
  *    "manufacturer": "TurboChef",
  *    "type": "3d",
  *    "note": null,
  *    "pak": " iSeries",
  *    "html5": 0,
  *    "safety": -1,
  *    "short_description": null,
  *    "status": "Active to Enroll",
  *    "end_at": "2016-11-29 11:05:07"
  *},
  *{
  *    "id": 103,
  *    "course_id": 45950,
  *    "name": "Scotsman: Prodigy Eclipse Ice Cuber EH222",
  *    "manufacturer": "Scotsman Ice Systems",
  *    "type": "course",
  *    "note": null,
  *    "pak": "Prodigy Eclipse Ice Cuber EH222",
  *    "html5": 1,
  *    "safety": -1,
  *    "short_description": null,
  *    "status": "Enrolled",
  *    "end_at": null,
  *    "enrolled_at": "2015-11-30 12:27:52"
  *}
  *   ]
  */
 public static function getEnrollments($idUser)
 {
     $app = \Slim\Slim::getInstance();
     if (!User::find($idUser)) {
         $app->response->setStatus(400);
         return json_encode("User does not exist");
     }
     $enrollments = User::find($idUser)->enrollment;
     $active_enrollment_ids = Enrollment::where('end_at', '>', date('Y-m-d H:i:s'))->orwhere('end_at', null)->where('user_id', '=', $idUser)->lists('course_id')->toArray();
     $result = [];
     foreach ($enrollments as &$enrollment) {
         if (!is_null($enrollment->end_at)) {
             if (date("Y-m-d H:i:s") > $enrollment->end_at) {
                 $enrollment->status = "expired";
                 continue;
             }
         }
         $course = Enrollment::find($enrollment->id)->course;
         if ($course->type == "membership") {
             if ($enrollment->status == "expired") {
                 continue;
             }
             $membership_courses = Catalog::find($course->id)->course()->where("isPublished", "1");
             foreach ($membership_courses as $key => $value) {
                 if (is_array($active_enrollment_ids) && in_array($value->id, $active_enrollment_ids)) {
                     continue;
                 }
                 $data = array("membership_id" => $enrollment->course_id, "course_id" => $value->id, "name" => $value->name, "manufacturer" => $value->manufacturer, "type" => $value->type, "note" => $value->note, "pak" => trim($value->pak), "html5" => $course->html5, "safety" => $enrollment->isSafety, "short_description" => $value->shortDescription, "status" => "Active to Enroll", "scorm_registration_id" => $enrollment->scorm_registration_id, "end_at" => $enrollment->end_at);
                 array_push($result, $data);
             }
         } else {
             $data = array("id" => $enrollment->id, "course_id" => $course->id, "name" => $course->name, "manufacturer" => $course->manufacturer, "type" => $course->type, "note" => $course->note, "pak" => trim($course->pak), "html5" => $course->html5, "safety" => $enrollment->isSafety, "short_description" => $course->shortDescription, "progress" => $enrollment->progress, "status" => ucfirst($enrollment->status), "end_at" => $enrollment->end_at, "scorm_registration_id" => $enrollment->scorm_registration_id, "enrolled_at" => date($enrollment->created_at));
             array_push($result, $data);
         }
     }
     // Add additional recommend course to user's library
     $paks = array();
     $courses = array();
     foreach ($result as $data) {
         if (!in_array($data['pak'], $paks)) {
             array_push($paks, trim($data['pak']));
         }
         array_push($courses, $data['course_id']);
     }
     foreach ($paks as $key => $value) {
         $ids = Course::where('pak', '=', $value)->lists('id')->toArray();
         foreach ($ids as $id) {
             if (!in_array($id, $courses)) {
                 $course = Course::find($id);
                 $price = Price::where('course_id', $id)->orderBy('length')->first();
                 //priority
                 $data = array("status" => "Recommend to buy", "course_id" => $course->id, "name" => $course->name, "manufacturer" => $course->manufacturer, "type" => $course->type, "note" => $course->note, "pak" => trim($course->pak), "html5" => $course->html5, "short_description" => $course->shortDescription);
                 if ($price) {
                     $data['price'] = $price->price;
                     $data['idSale'] = $price->id;
                 }
                 array_push($result, $data);
//.........这里部分代码省略.........
开发者ID:aanyun,项目名称:PHP-Sample-Code,代码行数:101,代码来源:UserController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $product = Product::where('id', $id)->firstOrFail();
     // return Response::json(Input::all());
     $product->setProductKey(trim(Input::get('product_key')));
     $product->setNotes(trim(Input::get('notes')));
     $product->setUnits(Input::get('units'));
     $product->setCc(Input::get('volume'));
     $product->setPackTypes(Input::get('type'));
     $product->setIce(Input::get('ice'));
     $typePrices = PriceType::orderBy('id', 'ASC')->get();
     $default_cost = Input::get('price-1');
     $product->save();
     foreach ($typePrices as $type) {
         $price = Price::where('product_id', $product->id)->where('price_type_id', $type->id)->first();
         $prices->account_id = 1;
         //if(Input::get('price-'.$price->id))
         $price->cost = Input::get('price-' . $price->id);
         // else
         //   $price =$default_cost;
         $price->price_type_id = $type->id;
         $price->product_id = $product->id;
         $price->save();
     }
     Session::flash('message', "Producto actualizado con exito");
     return Redirect::to('productos');
 }
开发者ID:Vrian7ipx,项目名称:repocas,代码行数:33,代码来源:ProductController.php

示例5: getCourseBundleDetail

 /**
  * @api {get} /courses/:id/bundle/detail Get Available Courses for bundle
  * @apiName Get Available Courses for bundle
  * @apiGroup Course
  * @apiDescription Returns a collection of items that can be shown in the a bundle.
  *
  * @apiSuccessExample {json} Success-Response:
  *   HTTP/1.1 200 OK
  *	[
  *		{"id":26453,
  *		"code":"258010",
  *		"name":"E-Course: Alto-Shaam: Combitherm Electric Oven Steamer",
  *		"pak":"Combitherm Electric Oven Steamer",
  *		"manufacturer":"Alto-Shaam",
  *		"fuse_id":null,
  *		"fuse_status":"",
  *		"shortDescription":"short descr",
  *		"note":null,
  *		"isPublished":1,
  *		"time":180,"type":
  *		"course","safety":-1,
  *		"html5":0,"video":
  *		"https:\/\/player.vimeo.com\/video\/50304386",
  *		"scorm_id":"ScormTest5f4888ea-f79b-4487-9346-6bc77c1a266d",
  *		"scrom_zip_file_path":null,
  *		"thumbnail":"http:\/\/localhost\/ignitor-api\/courses\/thumbnail\/26453",
  *		"price" : "450",
  *       "idSale" : "321"
  *		}
  *	]
  */
 public static function getCourseBundleDetail($idCourse)
 {
     $app = \Slim\Slim::getInstance();
     $course = self::getCourseDetails($idCourse, false);
     if (!($course->type == "bundle")) {
         $app->halt("400", json_encode("Not a course"));
     }
     //$catalog = Catalog::where('id','=',$idCourse)->get();
     $courseIds = Catalog::find($idCourse)->course->lists('id')->toArray();
     $result = [];
     foreach ($courseIds as &$courseId) {
         $course = Course::find($courseId);
         $price = Price::where('course_id', $course->id)->orderBy('length')->first();
         //priority
         if ($price) {
             $course['price'] = $price->price;
             $course['idSale'] = $price->id;
         }
         array_push($result, $course);
     }
     return json_encode($result);
 }
开发者ID:aanyun,项目名称:PHP-Sample-Code,代码行数:53,代码来源:CourseController.php

示例6: getPriceId

 public static function getPriceId($price)
 {
     $price = Price::where('min', '<=', $price)->where('max', '>=', $price)->first();
     $priceLastMin = Price::whereNull('max')->first();
     if (isset($price)) {
         return $price->id;
     }
     if ($price > $priceLastMin) {
         return $priceLastMin->id;
     }
     return 1;
 }
开发者ID:trantung,项目名称:online_market,代码行数:12,代码来源:CommonProduct.php


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