本文整理匯總了PHP中Food::where方法的典型用法代碼示例。如果您正苦於以下問題:PHP Food::where方法的具體用法?PHP Food::where怎麽用?PHP Food::where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Food
的用法示例。
在下文中一共展示了Food::where方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: edit_get
public function edit_get($id)
{
$this->_data['data'] = Food::where("food_id", $id)->first();
return View::make("admin.content.food.edit", $this->_data)->with("titlePage", "Edit Food")->with("titleTable", "Sửa món ăn tại nhà hàng");
}
示例2: function
// 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();
if ($food) {
$food->user = $food->profile();
return $response->write(json_encode($food) . ' ');
}
return $response->write('{"msg": "ERR"}');
})->setName('food_detail');
// yemeğe yapılan yorumlar
$this->get('/{id:[0-9]+}/comments/{page:[0-9]+}', function ($request, $response, $args) {
$comments = Comment::where('food_id', $args['id'])->where('deleted', 0)->take(10)->offset($args['page'] * 10)->orderBy('comment_id', 'DESC')->get();
return $response->write(json_encode($comments) . ' ');
})->setName('food_comments');
// yemek ekle
$this->post('', function ($request, $response, $args) {
示例3: foods
/**
*
* @param $typing
* @return mixed
*/
private function foods($typing)
{
$foods = Food::where('user_id', Auth::user()->id)->where('name', 'LIKE', $typing)->with('defaultUnit')->with('units')->get();
return $foods;
}