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


PHP State::where方法代码示例

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


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

示例1: setStateAttribute

 public function setStateAttribute($value)
 {
     if (strlen($value) == 2) {
         $this->attributes['state_a2'] = strtoupper($value);
     } else {
         $operator = \Config::get('database.default') == 'pgsql' ? 'ilike' : 'like';
         $state = State::where('name', $operator, $value)->first();
         if ($state) {
             $this->attributes['state_a2'] = $state->a2;
         }
     }
     if (!empty($this->attributes['state_a2'])) {
         $this->attributes['state_name'] = Addresses::stateName($this->attributes['state_a2']);
     }
 }
开发者ID:theguild,项目名称:laravel-addresses,代码行数:15,代码来源:Address.php

示例2: load_states

 public function load_states()
 {
     $country_id = $_POST['country_id'];
     $states = new State();
     if ($country_id > 0) {
         $states->where('country_id', $country_id);
     }
     $states->get();
     echo '<select name="state_id" class="form-control">';
     echo '<option value="">-- select state --</option>';
     foreach ($states as $key => $state_item) {
         echo '<option value="' . $state_item->id . '">' . $state_item->state_name . '</option>';
     }
     echo '</select>';
 }
开发者ID:ultraauchz,项目名称:asean_cultural_mapping,代码行数:15,代码来源:states.php

示例3: sendEmails

 public function sendEmails()
 {
     $colonia = Session::get("colonia");
     $coloniaName = Colony::find($colonia);
     $urbanism = Urbanism::where('colony_id', '=', $colonia)->first();
     $state = State::where('id', $coloniaName->City->state_id)->first()->name;
     $ciudad = $coloniaName->City->name;
     $contenido = Input::get('contenido');
     $user_id = Input::get('email');
     $asunto = Input::get('asunto');
     $admin_colonia = Neighbors::where('user_id', '=', Auth::user()->id)->first();
     $optGroup = Input::get('optGroup');
     if ($user_id == 'Todos' && $optGroup == NULL) {
         $neighbors = NeighborProperty::with('Neighbors')->where('urbanism_id', '=', $urbanism->id)->where('neighbors_id', '!=', $admin_colonia->id)->get();
         foreach ($neighbors as $neighbor) {
             $email = $neighbor->Neighbors->User->email;
             $data = array('email' => $email, 'link' => 'ConfirmationController@confirm', 'code' => "jhhjdhsdhhdsjhdsh", 'name_inv' => $admin_colonia->name, 'lname_inv' => $admin_colonia->last_name, 'urbanism' => $urbanism->name, 'contenido' => $contenido, 'asunto' => $asunto, 'coloniaName' => $coloniaName, 'estado' => $state, 'ciudad' => $ciudad);
             Mail::send('emails.email_masivos', $data, function ($message) use($email, $asunto) {
                 $message->subject($asunto);
                 $message->to($email);
             });
         }
     }
     if ($optGroup == 'Vecinos') {
         $email = User::findOrFail($user_id)->email;
         $data = array('email' => $email, 'link' => 'ConfirmationController@confirm', 'code' => "jhhjdhsdhhdsjhdsh", 'name_inv' => $admin_colonia->name, 'lname_inv' => $admin_colonia->last_name, 'urbanism' => $urbanism->name, 'contenido' => $contenido, 'asunto' => $asunto, 'coloniaName' => $coloniaName, 'estado' => $state, 'ciudad' => $ciudad);
         Mail::send('emails.email_masivos', $data, function ($message) use($email, $asunto) {
             $message->subject($asunto);
             $message->to($email);
         });
     }
     if ($optGroup == 'Roles') {
         $neighbors = NeighborProperty::join('neighbors', 'neighbors.id', '=', 'neighbors_properties.neighbors_id')->join('assigned_roles', 'neighbors.user_id', '=', 'assigned_roles.user_id')->where('assigned_roles.colony_id', '=', $colonia)->where('urbanism_id', '=', $urbanism->id)->where('assigned_roles.role_id', '=', $user_id)->get();
         foreach ($neighbors as $neighbor) {
             $email = $neighbor->Neighbors->User->email;
             $data = array('email' => $email, 'link' => 'ConfirmationController@confirm', 'code' => "jhhjdhsdhhdsjhdsh", 'name_inv' => $admin_colonia->name, 'lname_inv' => $admin_colonia->last_name, 'urbanism' => $urbanism->name, 'contenido' => $contenido, 'asunto' => $asunto, 'coloniaName' => $coloniaName, 'estado' => $state, 'ciudad' => $ciudad);
             Mail::send('emails.email_masivos', $data, function ($message) use($email, $asunto) {
                 $message->subject($asunto);
                 $message->to($email);
             });
         }
     }
 }
开发者ID:prianticonsulting,项目名称:Habitaria,代码行数:43,代码来源:ColonyController.php

示例4: getStates

 /**
  * Return collection of all states/provinces within a country
  * TODO: caching to make this fetch speedy speedy
  *
  * @param string 2 letter country alpha-code
  * @return Collection
  */
 public static function getStates($countryA2 = 'CA')
 {
     if (strlen($countryA2) != 2) {
         throw new InvalidValueException();
     }
     return Cache::rememberForever('addresses.' . $countryA2 . '.states', function () use($countryA2) {
         return State::where('country_a2', $countryA2)->orderBy('name', 'ASC')->get();
     });
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:16,代码来源:Address.php

示例5: postCreate

 public function postCreate()
 {
     $postdata = file_get_contents("php://input");
     if (!empty($postdata)) {
         $userName = Input::get('userName');
         $userEmail = Input::get('userEmail');
         $userMobile = Input::get('userMobile');
         $userAddress1 = Input::get('userAddress1');
         $userAddress2 = Input::get('userAddress2');
         $userCity = Input::get('userCity');
         $userState = Input::get('userState');
         $userPincode = Input::get('userPincode');
         $userType = Input::get('userType');
         $currentUserId = Input::get('currentUserId');
         $currentUserIdPk = Input::get('currentUserIdPk');
         $parentId = Input::get('parentId');
         $parentIdPk = Input::get('parentIdPk');
         $lockbalance = Input::get('lock_balance');
         $mainbalance = Input::get('main_balance');
         $usercount = Input::get('user_count');
         $userStatus = Input::get('userStatus');
         $products = Input::get('products');
         $createdat = Commonmodel::dateandtime();
         $clientIp = Input::get('clientIp');
         if ($userEmail != "" && $userMobile != "" && $userAddress1 != "" && $userAddress2 != "" && $userCity != "" && $userState != "" && $userPincode != "" && $userType != "" && $currentUserId != "" && $currentUserIdPk != "" && $parentIdPk != "" && $userStatus != "" && $products != "" && $userName != '') {
             if (empty($lockbalance)) {
                 $checkbalancedetection = Balancedetection::where('bal_usr_roll', '=', $userType)->get();
                 if (count($checkbalancedetection) > 0) {
                     $lockbalance = Balancedetection::where('bal_usr_roll', '=', $userType)->pluck('bal_detn_amt');
                 } else {
                     $lockbalance = 0;
                 }
             }
             if (empty($mainbalance)) {
                 $mainbalance = 0;
             }
             $checklockbalance = Userfinance::where('ufin_user_id', '=', $currentUserId)->pluck('ufin_lock_balance');
             $checkmainbalance = Userfinance::where('ufin_user_id', '=', $currentUserId)->pluck('ufin_main_balance');
             if ($checkmainbalance < $checklockbalance) {
                 return Response::json(array('status' => 'failure', 'message' => 'Your lock balance is too low to create this user with mentioned amount'));
             } else {
                 $checkbalancecreate = $checkmainbalance - $checklockbalance;
                 if ($checkbalancecreate < $mainbalance) {
                     return Response::json(array('status' => 'failure', 'message' => 'You have Insufficient Balance '));
                 } else {
                     $newbalance = $checkmainbalance - $mainbalance;
                     if (!empty($products)) {
                         $emailcheck = User::where('UD_USER_EMAIL', $userEmail)->get();
                         if (count($emailcheck) > 0) {
                             return Response::json(array('status' => 'failure', 'message' => 'Email ID Already Exist'));
                         } else {
                             $mobilenumcheck = User::where('UD_USER_MOBILE', $userMobile)->get();
                             if (count($mobilenumcheck) > 0) {
                                 return Response::json(array('status' => 'failure', 'message' => 'Phone Number Already Exist'));
                             } else {
                                 if ($userType != 'SP') {
                                     $getusercount = count(User::where('UD_USER_TYPE', '=', $userType)->get());
                                     $checkstatedetailsf = Balancedetection::where('bal_usr_roll', '=', $userType)->pluck('user_reg_count');
                                     $checkindiviudalcount = User::where('UD_ID_PK', '=', $parentIdPk)->pluck('UD_USER_CREATE_COUNT');
                                     if ($getusercount <= $checkstatedetailsf) {
                                         if ($userType == 'SAS') {
                                             $currentcountcheck = Balancedetection::where('bal_usr_roll', '=', 'SA')->pluck('user_reg_count');
                                         } elseif ($userType == 'SP') {
                                             $currentcountcheck = Balancedetection::where('bal_usr_roll', '=', 'SA')->pluck('user_reg_count');
                                         } elseif ($userType == 'SPS') {
                                             $currentcountcheck = Balancedetection::where('bal_usr_roll', '=', 'SP')->pluck('user_reg_count');
                                         } elseif ($userType == 'SD') {
                                             $currentcountcheck = Balancedetection::where('bal_usr_roll', '=', 'SP')->pluck('user_reg_count');
                                         } elseif ($userType == 'SDS') {
                                             $currentcountcheck = Balancedetection::where('bal_usr_roll', '=', 'SD')->pluck('user_reg_count');
                                         } elseif ($userType == 'D') {
                                             $currentcountcheck = Balancedetection::where('bal_usr_roll', '=', 'SD')->pluck('user_reg_count');
                                         } elseif ($userType == 'DS') {
                                             $currentcountcheck = Balancedetection::where('bal_usr_roll', '=', 'D')->pluck('user_reg_count');
                                         } elseif ($userType == 'FR') {
                                             $currentcountcheck = Balancedetection::where('bal_usr_roll', '=', 'D')->pluck('user_reg_count');
                                         } elseif ($userType == 'FRS') {
                                             $currentcountcheck = Balancedetection::where('bal_usr_roll', '=', 'FR')->pluck('user_reg_count');
                                         } elseif ($userType == 'SFR') {
                                             $currentcountcheck = Balancedetection::where('bal_usr_roll', '=', 'FR')->pluck('user_reg_count');
                                         } elseif ($userType == 'SFRS') {
                                             $currentcountcheck = Balancedetection::where('bal_usr_roll', '=', 'FR')->pluck('user_reg_count');
                                         }
                                         $usercountdetails = count(User::where('UD_USER_TYPE', '=', $userType)->get());
                                     } elseif ($getusercount <= $checkindiviudalcount) {
                                         $usercountdetails = count(User::where('UD_USER_TYPE', '=', $userType)->get());
                                         $currentcountcheck = $checkindiviudalcount;
                                     } else {
                                         return Response::json(array('status' => 'failure', 'message' => 'You Reached Limit for creating Sub Role'));
                                     }
                                 } else {
                                     $getusercount = Balancedetection::where('bal_usr_roll', '=', 'SP')->pluck('user_reg_count');
                                     $checkstatedetailsf = count(User::where('UD_USER_TYPE', '=', $userType)->where('UD_USER_STATE', '=', $userState)->get());
                                     $stateusercountdetails = count(State::where('adt_state_name', '=', $userState)->get());
                                     if (count($checkstatedetailsf) > $getusercount) {
                                         $usercountdetails = count(User::where('UD_USER_TYPE', '=', $userType)->where('UD_USER_STATE', '=', $userState)->get());
                                         $currentcountcheck = State::where('adt_state_name', '=', $userState)->pluck('adt_state_count');
                                         $statpatuserid = State::where('adt_state_name', '=', $userState)->pluck('adt_state_code');
                                     } elseif (count($checkstatedetailsf) <= $getusercount) {
                                         $usercountdetails = count(User::where('UD_USER_TYPE', '=', $userType)->where('UD_USER_STATE', '=', $userState)->get());
//.........这里部分代码省略.........
开发者ID:arctic-dev,项目名称:appandukan-ws,代码行数:101,代码来源:UserController.php

示例6: postregister

 public function postregister()
 {
     $rules = array('state' => 'required', 'city' => 'required', 'other_city' => 'required_if:city,other', 'centre' => 'required_if:city,other', 'school' => 'required', 'name' => "required_if:school,other|string", 'addr1' => 'required_if:school,other', 'pincode' => 'required_if:school,other|digits:6', 'contact' => 'required_if:school,other', 'squad' => 'required', 'language' => 'required', 'name1' => "required|Regex:/^[\\p{L} .'-]+\$/", 'email1' => 'required|email', 'contact1' => 'required|numeric', 'name2' => "required|Regex:/^[\\p{L} .'-]+\$/", 'email2' => 'required|email', 'contact2' => 'required|numeric');
     $messages = array('name.regex' => 'School name can have words, commas, dashes, single quotes and dots.', 'pincode.digits' => 'Pincode can have exactly 6 digits.', 'contact.numeric' => 'School contact can have only digits.', 'name1.regex' => 'Name of Particpant 1 can have words, commas, dashes, single quotes and dots.', 'contact1.numeric' => 'Contact of Participant 1 can have only digits.', 'email1.email' => 'Email ID of Participant 1 has to be a valid email address.', 'name2.regex' => 'Name of Particpant 2 can have words, commas, dashes, single quotes and dots.', 'contact2.numeric' => 'Contact of Participant 2 can have only digits.', 'email2.email' => 'Email ID of Participant 2 has to be a valid email address.');
     $validator = Validator::make(Input::all(), $rules, $messages);
     if ($validator->fails()) {
         Input::flash();
         return Redirect::to('register')->withErrors($validator)->withInput();
     } else {
         if (Input::get('city') === 'other') {
             $city = new City();
             $city->name = ucwords(strtolower(Input::get('other_city')));
             $city->state_id = Input::get('state');
             $state = State::where('id', Input::get('state'))->first();
             $city->region = $state->region;
             //                $code=City::where('region', $state->region)->orderBy('code', 'desc')->first();
             //                $city->code=($code->code) + 1;
             $city->save();
             $cities = City::where('name', Input::get('other_city'))->orderBy('id', 'desc')->first();
             $city = $cities->id;
         } else {
             $city = Input::get('city');
         }
         if (Input::get('centre') !== "") {
             $centre = Input::get('centre') * 10;
         } else {
             $centre = $city * 10;
         }
         if (Input::get('school') === 'other') {
             $school = new School();
             $school->name = strtoupper(Input::get('name'));
             $school->address = strtoupper(Input::get('addr1') . ', ' . Input::get('addr2'));
             $school->pincode = Input::get('pincode');
             $school->contact = Input::get('contact');
             $school->email = Input::get('email');
             $school->city_id = $city;
             $school->save();
             $schools = School::where('name', Input::get('name'))->orderBy('id', 'desc')->first();
             $school = $schools->id;
         } else {
             $school = Input::get('school');
         }
         $user = new User();
         $user->name1 = strtoupper(Input::get('name1'));
         $user->email1 = Input::get('email1');
         $user->contact1 = Input::get('contact1');
         $user->name2 = strtoupper(Input::get('name2'));
         $user->email2 = Input::get('email2');
         $user->contact2 = Input::get('contact2');
         $user->squad = Input::get('squad');
         $user->school_id = $school;
         $user->language = Input::get('language');
         $user->city_id = $city;
         $user->centre_id = $centre;
         $roll = "";
         if (Input::get('squad') === 'JUNIOR') {
             $roll = "J";
         } else {
             $roll = "H";
         }
         if (Input::get('language') === 'en') {
             $roll .= "E";
         } else {
             $roll .= "H";
         }
         $centre_id = City::where('id', $centre / 10)->orderBy('id')->first();
         //            $code=$centre_id->id;
         $roll .= $centre_id->code;
         $roll .= 1;
         $lastroll = User::withTrashed()->where('roll', 'LIKE', "%{$roll}%")->count();
         $roll .= str_pad(strval($lastroll + 1), 4, "0", STR_PAD_LEFT);
         $user->roll = $roll;
         $user->year = 2015;
         $password = str_random(6);
         $user->password = Hash::make($password);
         $user->save();
         $school = School::find($user->school_id);
         $city = City::find($user->city_id);
         $state = State::find($city->state_id);
         Mail::send('emails.registered', array('user' => $user, 'school' => $school, 'city' => $city, 'state' => $state, 'password' => $password, 'name' => $user->name1), function ($message) use($user) {
             $message->to($user->email1, $user->name1)->subject('Technothlon Registration Details');
         });
         Mail::send('emails.registered', array('user' => $user, 'school' => $school, 'city' => $city, 'state' => $state, 'password' => $password, 'name' => $user->name2), function ($message) use($user) {
             $message->to($user->email2, $user->name2)->subject('Technothlon Registration Details');
         });
         Input::flush();
         //            return Redirect::route('home');
         return View::make('layouts.registersuccess')->with('user', $user);
     }
 }
开发者ID:aneeshdash,项目名称:technothlon-2015,代码行数:90,代码来源:HomeController.php


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