本文整理匯總了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);
}