當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Food::select方法代碼示例

本文整理匯總了PHP中Food::select方法的典型用法代碼示例。如果您正苦於以下問題:PHP Food::select方法的具體用法?PHP Food::select怎麽用?PHP Food::select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Food的用法示例。


在下文中一共展示了Food::select方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Material

             $newMaterial = new Material();
             $newMaterial->name = $material;
             $newMaterial->create_date = date("YmdHi");
             $newMaterial->last_update_date = date("YmdHi");
             $newMaterial->save();
         }
     }
     $sqlStr = "*" . implode("* *", $materials) . "*";
     // giri *domates* *tavuk* *malzeme* şeklindedir
     // saklı yordam kullanılmıştır
     $foods = Food::hydrateRaw("CALL searchRecipe(?)", array($sqlStr));
     return $response->write(json_encode($foods) . "     ");
 })->setName('search_foods');
 // sayfalı son yemekler
 $this->get('/all/{page:[0-9]+}', function ($request, $response, $args) {
     $food = Food::select('food_id', 'name', 'description')->where('deleted', 0)->take(6)->offset($args['page'] * 6)->orderBy('food_id', 'DESC')->get();
     if ($food) {
         return $response->write(json_encode($food) . '     ');
     }
     return $response->write('{"msg": "ERR"}');
 })->setName('foods');
 // sayfalı son yemekler
 $this->get('/popular/{page:[0-9]+}', function ($request, $response, $args) {
     $food = Food::take(6)->offset($args['page'] * 6)->orderBy('displayed', 'DESC')->get();
     return $response->write(json_encode($food) . '     ');
 })->setName('popular_foods');
 // id'den yemek
 $this->get('/{id:[0-9]+}', function ($request, $response, $args) {
     $food = Food::where('food_id', $args['id'])->where('deleted', 0)->get()->first();
     $food->displayed = $food->displayed + 1;
     $food->save();
開發者ID:gokselpirnal,項目名稱:WhatTheFood-web,代碼行數:31,代碼來源:routes.php


注:本文中的Food::select方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。