本文整理汇总了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');
}
示例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]);
}
示例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());
}
}
示例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;
}
示例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);
}
示例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);
}
示例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 {
示例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();
}