本文整理匯總了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();