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


PHP Services::where方法代码示例

本文整理汇总了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));
 }
开发者ID:andrinda,项目名称:myhotel,代码行数:10,代码来源:ServicesController.php

示例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('/');
     }
 }
开发者ID:arunkullu64,项目名称:uksalon,代码行数:45,代码来源:UsersController.php

示例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);
 }
开发者ID:andrinda,项目名称:myhotel,代码行数:10,代码来源:BookingController.php


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