• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Food类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Food类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: putIn

 public function putIn(Food $content)
 {
     if (in_array($content->getType(), $this->forbiddenFood)) {
         throw new \ForbiddenFoodTypeException($content->getType());
     }
     $this->content = $content;
 }
开发者ID:keymic,项目名称:Employees,代码行数:7,代码来源:Microwave.php


示例3: wrapComponent

 private function wrapComponent(IComponent $component)
 {
     $component = new ProgramLang($component);
     $component->setFeature($this->progLange);
     $component = new Hardware($component);
     $component->setFeature($this->hardware);
     $component = new Food($component);
     $component->setFeature($this->food);
     return $component;
 }
开发者ID:CcrisS,项目名称:PHP-Patterns,代码行数:10,代码来源:ClientH.php


示例4: getFoodById

 public static function getFoodById($id)
 {
     self::$db = Database::getDB();
     $query = "select * from food where Food_id='{$id}'";
     $result = self::$db->query($query);
     $item = $result->fetch();
     $food = new Food($item["Food_Catagory"], $item["Food_Price"], $item["Food_Instock"], $item["Food_description"], $item["Food_mark"], $item["Food_Name"], $item["Food_Image"], $item["Discount_price"], $item["Viewed_times"], $item["Sales_volume"]);
     $food->setId($item["Food_id"]);
     return $food;
 }
开发者ID:zhaoyiyi,项目名称:php-project,代码行数:10,代码来源:FoodDB.php


示例5: wrapComponent

 private function wrapComponent(IComponent $component)
 {
     $component = new ProgramLang($component);
     $component->setFeature("php");
     $component = new Hardware($component);
     $component->setFeature("lin");
     $component = new Food($component);
     $component->setFeature("veg");
     return $component;
 }
开发者ID:bswiatek,项目名称:wzorce,代码行数:10,代码来源:Client.php


示例6: getfood

 public static function getfood($food_id)
 {
     global $db;
     $query = "SELECT * FROM foods WHERE foodID = {$food_id}";
     $result = $db->query($query);
     $row = $result->fetch();
     $category = CategoryRepository::getCategory($row['categoryID']);
     $food = new Food($row['calories'], $row['foodTitle'], $row['foodPrice'], $category);
     $food->setId($row['foodID']);
     return $food;
 }
开发者ID:arvin-tcm,项目名称:CS526_Web,代码行数:11,代码来源:food_repository.php


示例7: getList

 public function getList()
 {
     $food = new Food();
     $userId = $_SESSION["userId"];
     $result = SQL::query("SELECT * FROM calories WHERE user_id = " . $userId . ";");
     $response = array();
     for ($i = 0; $i < $result->num_rows; $i++) {
         $line = SQL::fetchAssoc($result);
         $foodData = $food->getById($line["food_id"]);
         $line["food_data"] = $foodData;
         array_push($response, $line);
     }
     return $response;
 }
开发者ID:asjs-dev,项目名称:lab.coop,代码行数:14,代码来源:Calories.class.php


示例8: 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


示例9: add_food_get

 public function add_food_get($menu_id)
 {
     $menu_name = Menu::where("menu_id", $menu_id)->first();
     $this->_data['foods'] = Food::paginate(10);
     $this->_data['menus'] = DB::table("menus")->join("menu_foods", "menus.menu_id", "=", "menu_foods.menu_id")->join("foods", "menu_foods.food_id", "=", "foods.food_id")->where("menus.menu_id", $menu_id)->orderBy("menu_foods.created_at", "desc")->get();
     return View::make("admin.content.menu.add_food", $this->_data)->with("titlePage", "Add Food In Menu")->with("titleTable", "Thêm món ăn vào thực đơn: <strong>" . $menu_name->menu_name . "</strong>")->with("menu_id", $menu_id);
 }
开发者ID:quanit94,项目名称:ABCKitchen,代码行数:7,代码来源:MenuController.php


示例10: findModel

 /**
  * Finds the User model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @param integer $create_date
  * @return GwTransactionLog the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Food::findOne(['id' => $id])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
开发者ID:Thinlt,项目名称:hadasai,代码行数:16,代码来源:CategoryController.php


示例11: deleteFood

 public function deleteFood($id)
 {
     $food = Food::find($id);
     if ($food->delete()) {
         return Redirect::route('userHome')->with('success', 'User deleted successfuly');
     } else {
         return Redirect::route('userHome')->with('fail', 'Error while deleting food');
     }
 }
开发者ID:milos01,项目名称:fridgeeapp.tk,代码行数:9,代码来源:UserController.php


示例12: 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


示例13: test

 public function test()
 {
     $this->load()->model('Food');
     $food = new Food();
     echo '<pre>';
     //print_r( $food->getById(14) );
     //print_r( $food->getById(14, array('limit'=>1)) );
     //print_r( $food->limit(10) );
     //print_r( $food->limit(10,'id,name') );
     //print_r( $food->limit(10,'name','id') );
     //print_r( $food->limit(10,'name,id','location') );
     //print_r( Food::_limit(10) );
     //print_r( $food->getOne() );
     //print_r( Food::_getOne() );
     //$food->location = 'Asia';
     //$food->food_type_id = 10;
     print_r($food->count());
     print_r(Food::_count());
     print_r(Food::_count($food));
     //Doo::cache('php')->set('foodtotal', Food::_count($food));
     //echo '<h1>'. Doo::cache('php')->get('foodtotal') .'</h1>';
     print_r(Food::getById__first(6));
     //$food->id = 14;
     //print_r( $food->getOne() );
     // print_r( $food->find() );
     //print_r( Food::_find($food) );
     //print_r( $food->getById_location__first(6, 'Malaysia') );
     //print_r( $food->getById_location(6, 'Malaysia', array('limit'=>1)) );
     //print_r( $food->relateFoodType($food, array('limit'=>'first')) );
     //print_r( $food->relateFoodType($food) );
     //print_r( $food->relateFoodType__first($food) );
     //print_r( Food::getById__location__first(6, 'Malaysia') );
     //print_r( Food::getById__location(6, 'Malaysia') );
     //print_r( Food::getById__first(6) );
     //print_r( Food::getByLocation('Malaysia') );
     //print_r( Food::relateFoodType__first($food) );
     //print_r( Food::relateFoodType() );
     //print_r( Food::relateFoodType_first() );
     //print_r( Food::_relate('', 'FoodType') );
     //
     //$f = new Food;
     //print_r( $f->relate('FoodType') );
     //print_r( $f->relate('FoodType', array('limit'=>'first')) );
     # if update/delete/insert cache auto purged on the Model.
     //$food->id = 6;
     //$food->name = 'Wan Tan Mee';
     //$food->update();
     //print_r($food->find());
     //$food->purgeCache();  #to delete cache manually
     //Food::_purgeCache();  #to delete cache manually
     # If no SQL is displayed, it means that the data are read from cache.
     # And of course your Model have to extend DooSmartModel
     print_r(Doo::db()->showSQL());
 }
开发者ID:mindaugas-valinskis,项目名称:doophp,代码行数:54,代码来源:MainController.php


示例14: calculate

 public static function calculate($id)
 {
     if ($id == 0) {
         return array();
     }
     $food = Food::getFood($id);
     $returnArray = array();
     // Search food components table for input food
     $foodComponents = FoodComponent::getComponentsWithChild($id);
     foreach ($foodComponents as $foodComponent) {
         $parentFood = Food::getFood($foodComponent["foodId"]);
         $returnArray[] = array("foodId" => $parentFood["id"], "foodName" => $parentFood["name"], "componentId" => $food["id"], "componentName" => $food["name"], "quantity" => $foodComponent["quantity"], "unitOfMeasure" => $food["unitOfMeasure"]);
     }
     return $returnArray;
 }
开发者ID:ncowan15,项目名称:FoodApp3,代码行数:15,代码来源:whereUsed.php


示例15: edit_post

 public function edit_post($id)
 {
     $valid = Validator::make(Input::all(), Food::rule_edit_food($id), Food::$food_langs);
     if ($valid->passes()) {
         $data = Input::all();
         $img = $data['food_image'];
         $isUpload = $img->move("uploads/food/");
         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"));
             DB::table("foods")->where("food_id", $id)->update($data);
             return Redirect::route("manage_food")->with("flash_success", "Chúc mừng bạn đã sửa món ăn thành công");
         }
         return Redirect::route("manage_food")->with("flash_error", "Không thể upload ảnh");
     }
     return Redirect::route("manage_food_edit_get", $id)->withInput()->with("flash_error", $valid->errors()->first());
 }
开发者ID:quanit94,项目名称:ABCKitchen,代码行数:16,代码来源:FoodController.php


示例16: addFood

 public static function addFood($id, &$shoppingArray, $quantity = 0)
 {
     if ($id == 0) {
         return array();
     }
     // Prepare needed data
     $food = Food::getFood($id);
     $foodComponents = FoodComponent::getComponents($id);
     if (sizeof($foodComponents) == 0) {
         // Default to serving size in this case
         if ($quantity == 0) {
             $quantity = $food["quantity"];
         }
         // No components, just add entry for self
         self::addShopping($shoppingArray, $id, $food, $quantity);
     } else {
         // Default to recipe quantity in this case
         if ($quantity == 0) {
             $quantity = $food["recipeQuantity"];
         }
         if ($quantity == 0) {
             $quantity = $food["quantity"];
         }
         // Return shopping for each component
         foreach ($foodComponents as $foodComponent) {
             // Determine component quantity needed
             if ($food["recipeQuantity"] == 0) {
                 $food["recipeQuantity"] = $food["quantity"];
             }
             if ($food["recipeQuantity"] == 0) {
                 $food["recipeQuantity"] = 1;
             }
             $componentQuantity = $foodComponent["quantity"] * $quantity / $food["recipeQuantity"];
             self::addFood($foodComponent["componentId"], $shoppingArray, $componentQuantity);
         }
     }
 }
开发者ID:ncowan15,项目名称:FoodApp3,代码行数:37,代码来源:shoppingList.php


示例17: testFoodIsComposedByEightGroupsOfNutrients

 public function testFoodIsComposedByEightGroupsOfNutrients()
 {
     Food::box(['carbohydrates' => 42, 'proteins' => 42, 'fats' => 42, 'minerals' => 42, 'vitamins' => 42, 'phytochemicals' => 42, 'fibers' => 42]);
 }
开发者ID:sensorario,项目名称:value-objects,代码行数:4,代码来源:FoodTest.php


示例18: function

<?php

require 'classes/Food.php';
// get all food items route
$app->get('/food/', function () use($session) {
    // if($session->isValidRequest() == 0){
    // 	$session->goodnight();
    // }
    try {
        $return = array();
        $return['success'] = true;
        $return['data'] = Food::getFood();
        $return['time'] = time();
        //$return['id'] = $_SESSION['user_id'];
        $return['sid'] = session_id();
        echo json_encode($return);
    } catch (Exception $e) {
        echo json_encode($e->getMessage());
    }
});
开发者ID:srigdev,项目名称:AuthApiExample,代码行数:20,代码来源:Food.php


示例19: header

        $errors = Food::Delete($_REQUEST['id']);
        if ($errors) {
            $model = Food::Get($_REQUEST['id']);
            $view = "food/delete.php";
        } else {
            header("Location: ?sub_action={$sub_action}&id={$_REQUEST['id']}");
            die;
        }
        break;
    case 'search_GET':
        $model = Food::Search($_REQUEST['q']);
        $view = 'food/index.php';
        break;
    case 'index_GET':
    default:
        $model = Food::Get();
        $view = 'food/index.php';
        break;
}
switch ($format) {
    case 'json':
        echo json_encode($model);
        break;
    case 'plain':
        include __DIR__ . "/../Views/{$view}";
        break;
    case 'web':
    default:
        include __DIR__ . "/../Views/shared/_Template.php";
        break;
}
开发者ID:JonathanOdgis,项目名称:WebProgrammingProject,代码行数:31,代码来源:foods.php


示例20: __construct

 public function __construct($meta = 0, $count = 1)
 {
     parent::__construct(self::BEETROOT_SOUP, 0, $count, "Beetroot Soup");
 }
开发者ID:maa123,项目名称:NIGHTMARE,代码行数:4,代码来源:BeetrootSoup.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ForeignKey类代码示例发布时间:2022-05-23
下一篇:
PHP Foo类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap