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


PHP Address::select方法代码示例

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


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

示例1: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $jobs = Job::whereNull('texted_at')->where('job_status_id', '=', JobStatus::$OPEN)->where('start_date', '>=', date("Y-m-d"))->orderBy("start_date")->get();
     $catJobs = array();
     $users = array();
     $userJobs = array();
     $userCategories = array();
     $user_ids = array();
     $jobs->load("jobCategory", "user");
     // echo '<pre>';
     //print_r($jobs);
     //echo '</pre>';
     foreach ($jobs as $job) {
         if (trim($job->latitude) != "" && trim($job->longitude) != "") {
             $userAddresses = Address::select("addresses.*", "student_profile.preferred_job_radius", Address::distanceSelectStatement($job->latitude, $job->longitude, 'distance', 'addresses'))->join("student_profile", "addresses.user_id", "=", "student_profile.user_id")->get();
             foreach ($userAddresses as $address) {
                 if ($address->distance > 0 && $address->distance <= $address->preferred_job_radius) {
                     //echo "here".$address->distance;
                     if (!isset($userCategories[$address->user_id])) {
                         $userCategories[$address->user_id] = StudentJobPreference::where('user_id', '=', $address->user_id)->lists('job_category_id');
                     }
                     if (in_array($job->job_category_id, $userCategories[$address->user_id]) == 1) {
                         if (!isset($userJobs[$address->user_id])) {
                             $user_ids[] = $address->user_id;
                             $userJobs[$address->user_id] = array();
                             $users[$address->user_id] = $address->user;
                         }
                         $userJobs[$address->user_id][] = $job;
                     }
                 }
             }
         }
         //$job->notified_at=date('Y-m-d h:i:s');
         $job->texted_at = date('Y-m-d h:i:s');
         $job->save();
     }
     $c = 0;
     if (count($user_ids) > 0) {
         $notifications = UserNotification::whereIn('user_id', $user_ids)->where("notification_types_id", '=', NotificationType::$SMS)->get();
         foreach ($notifications as $notification) {
             $user = $users[$notification->user_id];
             //$this->info($user->id);
             $c++;
             $this->info($notification->notification_value);
             $message = View::make('sms.commands.job_notifications');
             if (trim($notification->notification_value) != "" && !is_null($notification->notification_value)) {
                 try {
                     Twilio::message($notification->notification_value, substr($message, 0, 160));
                 } catch (Exception $e) {
                     \Log::info('Error: ' . $e->getMessage());
                     $this->info('Error: ' . $e->getMessage());
                 }
             }
         }
     }
     \Log::info('Cron Notification Text: ' . $c);
     $this->info($c . 'text sent');
 }
开发者ID:aeastmead,项目名称:blinxly,代码行数:63,代码来源:StudentJobNotificationTextsCommand.php

示例2: edit

 /**
  * Show the form for editing the specified outlet.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($outlet)
 {
     $countries = Country::lists('country', 'id');
     $cities = City::where('country_id', Country::DEFAULT_COUNTRY)->lists('city', 'id');
     $retailers = Retailer::owner()->lists('name', 'id');
     $addresses = Address::select(array('addresses.id', 'addresses.address'))->lists('address', 'id');
     $images = Picture::getByRefId($outlet->id, 'outlet');
     if ($outlet->status == 'active') {
         $title = Lang::get('site/outlets/title.outlet_update');
     } else {
         $title = Lang::get('site/outlets/title.create_a_new_outlet');
     }
     return View::make('site.outlets.edit', compact('countries', 'cities', 'outlet', 'title', 'retailers', 'addresses'))->nest('imageForm', 'site.partials.image.create', ['refId' => $outlet->id, 'type' => 'outlet', 'images' => $images]);
 }
开发者ID:EricBui0512,项目名称:FYP,代码行数:20,代码来源:OutletsController.php

示例3: index

 public function index()
 {
     if (Input::get('q')) {
         $id = 1;
         $datums = Address::select('city AS value')->where('city', 'like', '%' . Input::get('q') . '%')->distinct()->take(50)->get();
         foreach ($datums as $datum) {
             //print_r($datum->toArray());
             $datum->tokens = explode(' ', $datum->value);
             $datum->id = $id;
             $id++;
         }
         return Response::json($datums);
     } else {
         return Response::json(Address::select('city AS value')->distinct()->orderBy('updated_at', 'DESC')->take(50)->get());
     }
 }
开发者ID:strikles,项目名称:php,代码行数:16,代码来源:CityController.php

示例4: getAddresses

 /**
  * Show a list of all the cities formatted for Datatables.
  *
  * @return Datatables JSON
  */
 public function getAddresses($countryId = 0, $cityId = 0)
 {
     $fields = array('id', 'address', 'district', 'postal_code', 'addresses.created_at', 'addresses.updated_at');
     $query = Address::select($fields);
     if ($countryId) {
         $query = $query->byCountry($countryId);
     }
     if ($cityId) {
         $query = $query->byCity($cityId);
     }
     $addresses = array_merge(array('0' => 'All'), $query->orderBy('city_id')->lists('address', 'id'));
     return $addresses;
 }
开发者ID:EricBui0512,项目名称:FYP,代码行数:18,代码来源:RetailersController.php

示例5: update

 /**
  * 返回更新国家信息
  * @access public
  */
 function update()
 {
     $id = get_post_value('id');
     $field = array('region_id', 'country_id', 'region', 'status', 'orders');
     $m = new Address();
     $m->clear();
     $m->setField($field);
     $m->setTable('vcb_address_region');
     $m->setWhere('region_id', '=', $id);
     $data = $m->select();
     $this->assign('data', $data);
 }
开发者ID:koery,项目名称:Vcanbuy,代码行数:16,代码来源:RegionController.class.php

示例6: update

 /**
  * 返回更新国家信息
  * @access public
  */
 function update()
 {
     $id = get_post_value('id');
     $field = array('country.country_id', 'country.country', 'region.region_id', 'region.region', 'province.province_id', 'province.province', 'city.city_id', 'city.city', 'city.status', 'city.orders');
     $m = new Address();
     $m->clear();
     $m->setField($field);
     $m->setWhere('country.status', '!=', '50000');
     $m->setWhere('region.status', '!=', '50000');
     $m->setWhere('province.status', '!=', '50000');
     $m->setWhere('city.status', '!=', '50000');
     $m->setWhere('city.city_id', '=', $id);
     $m->setTable('vcb_address_country AS country');
     $m->setJoin('vcb_address_region as region', 'country.country_id=region.country_id');
     $m->setJoin('vcb_address_province as province', 'region.region_id=province.region_id');
     $m->setJoin('vcb_address_city as city', 'province.province_id=city.province_id');
     $data = $m->select();
     $this->assign('data', $data);
     $r = $m->getRegion($data[0]['country_id']);
     $this->assign('region', $r);
     //输出数据
     $p = $m->getProvince($data[0]['region_id']);
     $this->assign('province', $p);
 }
开发者ID:koery,项目名称:Vcanbuy,代码行数:28,代码来源:CityController.class.php

示例7: function

    }
});
//=============================================================================
//Address
//=============================================================================
Flight::route('GET /v1/main/address', function () {
    try {
        $array = Address::selectAll();
        Flight::ok($array);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('GET /v1/main/address/@id', function ($id) {
    try {
        $object = Address::select($id);
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('POST /v1/main/address', function () {
    try {
        $object = Address::insert();
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('PUT /v1/main/address/@id', function ($id) {
    try {
开发者ID:rhalf,项目名称:app_track,代码行数:31,代码来源:main.php

示例8: getAddresses

 /**
  * Show a list of all the cities formatted for Datatables.
  *
  * @return Datatables JSON
  */
 public function getAddresses($countryId = 0, $cityId = 0)
 {
     $fields = array('addresses.id', 'address', 'district', 'postal_code', 'addresses.created_at', 'addresses.updated_at');
     $query = Address::select($fields);
     if ($countryId) {
         $query = $query->byCountry($countryId);
     }
     if ($cityId) {
         $query = $query->byCity($cityId);
     }
     $addresses = $query->orderBy('city_id');
     return Datatables::of($addresses)->add_column('actions', '<a href="{{{ URL::to(\'admin/addresses/\' . $id . \'/edit\' ) }}}" class="iframe btn btn-xs btn-default">{{{ Lang::get(\'button.edit\') }}}</a>
                             <a href="{{{ URL::to(\'admin/addresses/\' . $id . \'/delete\' ) }}}" class="iframe btn btn-xs btn-danger">{{{ Lang::get(\'button.delete\') }}}</a>
         ')->remove_column('id')->make();
 }
开发者ID:EricBui0512,项目名称:FYP,代码行数:20,代码来源:AdminCommonController.php


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