本文整理汇总了PHP中Restaurant::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Restaurant::where方法的具体用法?PHP Restaurant::where怎么用?PHP Restaurant::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Restaurant
的用法示例。
在下文中一共展示了Restaurant::where方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Session
require_once '../classes/session.php';
require __DIR__ . '/../vendor/autoload.php';
$session = new Session();
$session->forceLogin('../index.php');
?>
<?php
include '../includes/header.php';
require_once '../classes/Restaurant.php';
require_once '../classes/Item.php';
require '../config.php';
require '../classes/boot.php';
if (isset($_GET['restaurant'])) {
$input = $_GET['restaurant'];
$res = Restaurant::where('place', 'LIKE', '%' . $input . '%')->get();
}
?>
<body>
<?php
include './includes/nav.php';
?>
<div class="customercontainer">
<div class="container">
<div class="row">
<div class="col s12">
<h4>Search Results</h3>
<ul class="collection">
<?php
foreach ($res as $res) {
示例2: index
/**
* Display a listing of the resource.
* GET /restaurants/{latitude}/{longitude}/{radius}
*
* @param latitude - The latitude of the user
* @param longitude - The longitude of the user
* @param radius - The radius from the user to check. .07 ~ 5 miles at the equator
*
* @return Response
*/
public function index()
{
$data = Input::only('latitude', 'longitude', 'radius');
$restaurants = Restaurant::where('latitude', '>', $data['latitude'] - $data['radius'])->where('latitude', '<', $data['latitude'] + $data['radius'])->where('longitude', '>', $data['longitude'] - $data['radius'])->where('longitude', '<', $data['longitude'] + $data['radius'])->get();
return Response::json($restaurants);
}