当前位置: 首页>>代码示例>>PHP>>正文


PHP Restaurant::search方法代码示例

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


在下文中一共展示了Restaurant::search方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: search

 /**
  * @param $query - The search query used to find restaurants
  */
 public function search($query)
 {
     $results = Restaurant::search($query);
     echo json_encode($results);
 }
开发者ID:agroff,项目名称:FindPuppies,代码行数:8,代码来源:Controller.php

示例2: array

    $restaurant->save();
    $cuisine = Cuisine::find($cuisine_id);
    return $app['twig']->render('cuisine.html.twig', array('cuisine' => $cuisine, 'restaurants' => $cuisine->getRestaurants()));
});
//Reviews page
$app->get("/restaurants/{id}", function ($id) use($app) {
    $restaurant = Restaurant::find($id);
    return $app['twig']->render('restaurant.html.twig', array('restaurant' => $restaurant, 'reviews' => $restaurant->getReviews()));
});
$app->post("/reviews", function () use($app) {
    $username = $_POST['username'];
    $date = $_POST['date'];
    $rating = $_POST['rating'];
    $comment = $_POST['comment'];
    $restaurant_id = $_POST['restaurant_id'];
    $review = new Review($username, $date, $rating, $comment, $restaurant_id, $id = null);
    $review->save();
    $restaurant = Restaurant::find($restaurant_id);
    return $app['twig']->render('restaurant.html.twig', array('restaurant' => $restaurant, 'reviews' => Review::getAll()));
});
//Cuisine_edit page
$app->get("/cuisines/{id}/edit", function ($id) use($app) {
    $cuisine = Cuisine::find($id);
    return $app['twig']->render('cuisine_edit.html.twig', array('cuisine' => $cuisine));
});
//Search result page
$app->get("/search", function () use($app) {
    $search = Restaurant::search($_GET['search']);
    return $app['twig']->render('search.html.twig', array('search' => $search, 'search_term' => $_GET['search']));
});
return $app;
开发者ID:Camolot,项目名称:restaurants,代码行数:31,代码来源:app.php

示例3: Restaurant

<body>
	<?php 
include "./include/navbar.php";
?>
	<div class="container" style="margin-top:100px;margin-bottom:50px;min-height:500px">
		<?php 
if (isset($_POST['location'])) {
    ?>
			<h1>Search: <?php 
    echo $_POST['location'];
    ?>
</h1>
			<div class="col-sm-8">
				<?php 
    $restaurant = new Restaurant();
    $data = $restaurant->search($_POST['location']);
    if (sizeof($data) > 0) {
        foreach ($data as $key => $value) {
            echo '<div class="row" restaurant-id="' . $value['id'] . '">
						<div class="col-sm-2">
						<a href="/restaurants.php?id=' . $value['id'] . '"><img src=".' . $value['image'] . '" height="90px" width="90px"></a>
						</div>
						<div class="col-sm-6">
						<a href="/restaurants.php?id=' . $value['id'] . '"><h4>' . ($key + 1) . '. ' . $value['name'] . '</h4></a>
						<h4>' . $value['rating'] . ' star rating ' . $value['review_count'] . ' reviews</h4>
						</div>
						<div class="col-sm-4">
						<h5>' . $value['address1'] . '</h5>
						<h5>' . $value['address2'] . '</h5>
						<h5>' . $value['phone'] . '</h5>
						</div>
开发者ID:manikanthtalasu,项目名称:restaurant-finder,代码行数:31,代码来源:search.php


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