本文整理汇总了PHP中Food::hydrateRaw方法的典型用法代码示例。如果您正苦于以下问题:PHP Food::hydrateRaw方法的具体用法?PHP Food::hydrateRaw怎么用?PHP Food::hydrateRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Food
的用法示例。
在下文中一共展示了Food::hydrateRaw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
$oldMaterial = $oldMaterial->first();
$oldMaterial->count += 1;
$oldMaterial->last_update_date = date("YmdHi");
$oldMaterial->save();
} else {
$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');