當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。