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


PHP Food::create方法代码示例

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


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

示例1: food

 protected function food()
 {
     if (!$this->session->status()) {
         return $this->_response("Authentication Required", 401);
     }
     $food = new Food();
     if ($this->method == 'GET') {
         if ($this->id) {
             return $food->getById($this->id);
         }
         return $food->getList();
     } else {
         if ($this->method == 'POST') {
             if ($this->data) {
                 return $food->create($this->data);
             }
         } else {
             if ($this->method == 'DELETE') {
                 if ($this->id) {
                     return $food->deleteById($this->id);
                 }
             }
         }
     }
     return "";
 }
开发者ID:asjs-dev,项目名称:lab.coop,代码行数:26,代码来源:API.php

示例2: run

 public function run()
 {
     Food::truncate();
     Food::create(['name' => 'Oats, Rolled', 'protein' => '0.11', 'carbohydrate' => '0.604', 'fat' => '0.081']);
     Food::create(['name' => 'Soy Milk', 'protein' => '0.033', 'carbohydrate' => '0.06', 'fat' => '0.018']);
     Food::create(['name' => 'Banana', 'protein' => '0.011', 'carbohydrate' => '0.23', 'fat' => '0.003']);
 }
开发者ID:mawaha,项目名称:tracker,代码行数:7,代码来源:FoodsTableSeeder.php

示例3: isAvaiableInFoodTable

 /**
  * Check name is exist in food table
  * return null if not exist
  * @param  $name name Vietnamese
  * @return  Food 
  */
 public function isAvaiableInFoodTable($name)
 {
     $slug = Utils::normalizeSlug($name);
     $sql = "select * from monan where slug = '" . $slug . "' limit 1";
     $query = mysql_query($sql);
     if (mysql_num_rows($query) > 0) {
         return Food::create(mysql_fetch_array($query));
     }
 }
开发者ID:doankhoi,项目名称:CrawlerDataFood,代码行数:15,代码来源:DB.php

示例4: add_post

 public function add_post()
 {
     $valid = Validator::make(Input::all(), Food::$rule_add_food, Food::$food_langs);
     if ($valid->passes()) {
         $data = Input::all();
         $img = $data['food_image'];
         $isUpload = $img->move("uploads/food/images/", $img->getClientOriginalName());
         if ($isUpload) {
             $data = array("food_name" => Input::get("food_name"), "food_price" => Input::get("food_price"), "food_description" => Input::get("food_description"), "food_image" => $img->getClientOriginalName(), "food_created_at" => date("Y-m-d"));
             Food::create($data);
             return Redirect::route("manage_food_add_get")->with("flash_success", "Chúc mừng bạn đã thêm món ăn thành công");
         }
         return Redirect::route("manage_food_add_get")->with("flash_success", "Không thể upload ảnh");
     }
     return Redirect::route("manage_food_add_get")->withInput()->with("flash_error", $valid->errors()->first());
 }
开发者ID:quanit94,项目名称:ABCKitchen,代码行数:16,代码来源:FoodController.php

示例5: create

 public function create()
 {
     return Food::create($this->params);
 }
开发者ID:ncowan15,项目名称:FoodApp3,代码行数:4,代码来源:foods.php


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