本文整理汇总了PHP中Services::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Services::where方法的具体用法?PHP Services::where怎么用?PHP Services::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Services
的用法示例。
在下文中一共展示了Services::where方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIndex
public function getIndex()
{
$key = Input::get('search');
if (isset($key)) {
$data = Services::where('name', 'like', '%' . $key . '%')->orderBy('id', 'desc')->paginate(10);
} else {
$data = Services::orderBy('id', 'desc')->paginate(10);
}
return View::make('home/dashboard', array())->nest('content', 'services/index', array('data' => $data));
}
示例2: search
public function search()
{
if (Input::All()) {
$book_for = Input::get('book_for');
$book_location = Input::get('book_location');
$book_date = Input::get('book_date');
//match service in services table if this service exist//
$services = Services::where('title', 'like', '%' . $book_for . '%')->orWhere('description', 'like', '%' . $book_for . '%')->get();
//match location from venue table who match this service with business id
$business_ids = array();
foreach ($services as $key => $val) {
$business_ids[] = $val->business_id;
}
$venueFind = Venue::where('city', 'like', '%' . $book_location . '%')->whereIn('business_id', $business_ids)->get();
$last_query = DB::getQueryLog();
// echo "<pre>";print_r($last_query);die;
// return View::make('search.listing')->with('data',$services);
$result = array();
foreach ($venueFind as $venue => $venueVal) {
$userBookings = $venueVal->business->user_booking();
$last_query = DB::getQueryLog();
//echo "<pre>";print_r($last_query);die;
if (isset($userBookings) && count($userBookings) > 0) {
//compare date
$date1 = date("m-d-Y", strtotime($userBookings->booking_date));
//echo $book_date.'<br>';
//echo $date1.'<br>';die;
if (!strtotime($date1) == strtotime($book_date)) {
$result[] = $venueVal->business;
}
} else {
//show in listing
// echo "<pre>";print_r($venueVal);die;
$result[] = $venueVal->business;
}
}
$data['city'] = Venue::get_unique_city();
$data['salon_listing'] = $result;
$this->layout->nest('content', 'search.listing', $data);
//echo "<pre>";print_r($services);die;
//match in user booking table if this service already booked
} else {
return Redirect::to('/');
}
}
示例3: getService
public function getService()
{
$q = Input::get('q');
$data = Services::where('name', 'like', '%' . $q . '%')->orderBy('name', 'asc')->limit(10)->get();
$array = array();
foreach ($data as $row) {
$array[] = array('id' => $row->id, 'text' => $row->name . ' - $' . $row->price);
}
echo json_encode($array);
}