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


PHP Phone::where方法代码示例

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


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

示例1: passwordReset

 public function passwordReset()
 {
     //TODO make new push token
     $token = Input::get('token');
     $udid = Input::get('udid');
     if (!$udid) {
         return $this->respondInsufficientPrivileges('user.no-device');
     }
     $smsEntry = SMS::where('token', $token)->orderBy('id')->first();
     if (!Input::has('password')) {
         return $this->respondInsufficientPrivileges('user.wrong-password');
     }
     $validator = Validator::make(Input::only('password'), ['password' => 'required|between:6,12']);
     if ($validator->fails()) {
         return $this->respondInsufficientPrivileges($validator->messages()->all());
     }
     if (!$smsEntry) {
         return $this->respondInsufficientPrivileges('user.invalid-token');
     }
     if (!$smsEntry->verified) {
         return $this->respondInsufficientPrivileges('user.phone-not-verified');
     }
     $phone = Phone::where('number', $smsEntry->phone)->first();
     $user = $phone->user;
     $user->password = Input::get('password');
     if ($user->save()) {
         //TODO create new auth token
         $user->devices->each(function (Device $device) {
             $device->pushTokens()->delete();
         });
         $user->devices()->delete();
         $smsEntry->delete();
         $device = Device::create(['udid' => $udid, 'auth_token' => base64_encode(openssl_random_pseudo_bytes(32)), 'phone' => 0]);
         $user->devices()->save($device);
         $response['user'] = $this->collectionTransformer->transformUserToSmall($user);
         $response['auth_token'] = $device->auth_token;
         return $this->respond($response);
     }
     return $this->respondServerError();
 }
开发者ID:SenhorBardell,项目名称:yol,代码行数:40,代码来源:UsersController.php

示例2: addNewLead

 public function addNewLead($domain, $linkedin_contact_id)
 {
     $domain = DomainHelper::getDomain($domain);
     $company_domain = CompanyDomain::where("linkedin_contact_id", "=", $linkedin_contact_id)->get();
     for ($i = 0; $i < count($company_domain); $i++) {
         $company_domain[$i]->status = CompanyDomain::UNSELECTED;
         $company_domain[$i]->save();
     }
     $company_domain = CompanyDomain::where("linkedin_contact_id", "=", $linkedin_contact_id)->where("url", "=", $domain)->first();
     if (count($company_domain) == 0) {
         $linkedin_contact = LinkedinContact::find($linkedin_contact_id);
         $company_domain = new CompanyDomain();
         $company_domain->url = $domain;
         $company_domain->linkedin_url = "";
         $company_domain->status = CompanyDomain::SELECTED;
         $company_domain = $linkedin_contact->companyDomain()->save($company_domain);
         $company_domain->save();
         if ($linkedin_contact->started_at == '' || $linkedin_contact->started_at == '0000-00-00 00:00:00') {
             $linkedin_contact->started_at = date("Y-m-d H:i:s");
             $linkedin_contact->save();
         }
     } else {
         $company_domain = CompanyDomain::find($company_domain->id);
         $company_domain->status = CompanyDomain::SELECTED;
         $company_domain->save();
     }
     //SEO Scrapping Start
     $company_seo_data = $this->scrapeCompanySEO($domain);
     $company_domain->seo_company_title = $company_seo_data['seo_company_title'];
     $company_domain->seo_company_descriptoin = $company_seo_data['seo_company_descriptoin'];
     $company_domain->seo_company_keywords = $company_seo_data['seo_company_keywords'];
     //SEO Scrapping End
     //Company Social URL --Start
     $company_social_url = $this->companySocialURL($domain);
     $company_domain->company_facebook_url = $company_social_url['company_facebook_url'];
     $company_domain->company_twitter_url = $company_social_url['company_twitter_url'];
     $company_domain->company_google_url = $company_social_url['company_google_url'];
     $company_domain->fullcontact_company = $company_social_url['full_contact_company'];
     //Company Social URL --End
     // Company Visistat --Start
     $params = array('website' => $domain);
     //Query by Domain
     $objVisistat = new Visistat();
     $response_Visistat = $objVisistat->makeCall($params);
     $company_domain->visistat = $response_Visistat;
     // Company Visistat URL --End
     $company_domain->save();
     $linkedin_contact = LinkedinContact::find($linkedin_contact_id);
     $domain_list = $linkedin_contact->companyDomain()->get();
     $domain = array();
     $email_list = array();
     $valid_email_array_list = array();
     $api_email_array_list = array();
     $emails = array();
     $key = "id-";
     foreach ($domain_list as $domain_item) {
         $domain_id = $domain_item->id;
         $domain["id-" . $domain_item->id] = $domain_item->url;
         if ($domain_item->status == CompanyDomain::SELECTED) {
             $key = "id-" . $domain_item->id;
             $email_list = $this->emailGenerator($linkedin_contact->firstname, $linkedin_contact->lastname, $domain_item->url);
             $final_domain = $domain_item->url;
             $test_domain = explode("www.", $domain_item->url);
             if (count($test_domain) == 2) {
                 $final_domain = $test_domain[1];
             }
             $check_email = strtolower($linkedin_contact->firstname . "_" . $linkedin_contact->lastname . '@' . $final_domain);
             //echo $check_email; exit;
             //save paid email for a specific contact according to history patterns of that domain
             $paid_db_email_patterns_list = PaidDatabaseEmail::select('url', 'pattern_id', 'level', 'percentage', 'paid_db')->distinct()->where("url", "=", $domain_item->url)->get();
             if (count($paid_db_email_patterns_list) > 0) {
                 foreach ($paid_db_email_patterns_list as $patterns) {
                     $paid_email = "";
                     switch ($patterns['pattern_id']) {
                         case 1:
                             $patt = $linkedin_contact->firstname;
                             //first
                             $paid_email = strtolower($patt . '@' . $final_domain);
                             break;
                         case 2:
                             $patt = $linkedin_contact->firstname . "." . $linkedin_contact->lastname;
                             //first.last
                             $paid_email = strtolower($patt . '@' . $final_domain);
                             break;
                         case 3:
                             $patt = substr($linkedin_contact->firstname, 0, 1) . '' . $linkedin_contact->lastname;
                             //flast
                             $paid_email = strtolower($patt . '@' . $final_domain);
                             break;
                         case 4:
                             $patt = $linkedin_contact->lastname;
                             //last
                             $paid_email = strtolower($patt . '@' . $final_domain);
                             break;
                         case 5:
                             $patt = $linkedin_contact->firstname . "_" . $linkedin_contact->lastname;
                             //first_last
                             $paid_email = strtolower($patt . '@' . $final_domain);
                             break;
                         case 6:
//.........这里部分代码省略.........
开发者ID:jadoonz,项目名称:Code-Sample,代码行数:101,代码来源:SearchController(Laravel).php

示例3: devicesAuth

 /**
  * Authorize new device,
  * request new access_token
  * @return Response
  */
 public function devicesAuth()
 {
     $number = Input::get('phone');
     $password = Input::get('password');
     $udid = Input::get('udid');
     if (!Input::has('udid')) {
         return $this->respondNotFound('Device id not found');
     }
     //TODO Validation
     $phone = Phone::where('number', $number)->first();
     if (!$phone) {
         return $this->respondNotFound('Phone not found');
     }
     $user = $phone->user;
     if (!$user) {
         return $this->respondNotFound('User not found');
     }
     if ($user->checkPasswordAttribute($password)) {
         $device = $user->devices()->where('udid', $udid)->first();
         if ($device) {
             //TODO hardcoded bad
             return $this->respond(['user' => ['id' => $user->id, 'name' => $user->name, 'img' => ["thumb" => $user->img_small, "middle" => $user->img_middle, "origin" => $user->img_large]], 'auth_token' => $device->auth_token]);
         } else {
             $newDevice = Device::create(['udid' => $udid, 'auth_token' => base64_encode(openssl_random_pseudo_bytes(32))]);
             $user->devices()->save($newDevice);
             return $this->respond(['user' => ['id' => $user->id, 'name' => $user->name, 'img' => ["thumb" => $user->img_origin, "middle" => $user->img_middle, "origin" => $user->img_origin]], 'auth_token' => $newDevice->auth_token]);
         }
     } else {
         return $this->respondInsufficientPrivileges('Wrong password');
         //TODO change to 401
     }
 }
开发者ID:SenhorBardell,项目名称:yol,代码行数:37,代码来源:AuthController.php

示例4: json_encode

    echo json_encode($data);
});
// Delete contact
$contactList->delete("/contacts/:id", function ($id) use($contactList) {
    $contact = Contact::find($id);
    if ($contact->delete()) {
        $data['msg'] = 'Contact deleted successfully!';
    } else {
        $data['msg'] = 'An error occurred while deleting the contact!';
    }
    $contactList->response()->header('Content-Type', 'application/json');
    echo json_encode($data);
});
// Get all phones to one contact
$contactList->get("/contact/:id/phone", function ($id) use($contactList) {
    $phones = Phone::where('contactId', '=', $id)->get();
    $contactList->response()->header('Content-Type', 'application/json');
    echo json_encode(objectToArray(json_decode($phones)));
});
// Add new phone
$contactList->post("/contact/:id/phone", function ($id) use($contactList) {
    $phone = $contactList->request->params('phone');
    $newPhone = new Phone();
    $newPhone->contactId = $id;
    $newPhone->phone = $phone;
    if ($newPhone->save()) {
        $data['msg'] = 'Phone saved successfully!';
        $data['id'] = $newPhone->id;
    } else {
        $data['msg'] = 'An error occurred while saving the phone!';
    }
开发者ID:vitorm11,项目名称:contactlist,代码行数:31,代码来源:index.php

示例5: mostrar_telefono

 public function mostrar_telefono()
 {
     $telefono_persona = Phone::where('fk_empresa', '=', null)->orderBy('fk_persona')->paginate(10);
     $telefono_empresa = Phone::where('fk_persona', '=', null)->orderBy('fk_empresa')->paginate(10);
     return View::make('telefono.listaTelefono', array('telefono_persona' => $telefono_persona, 'telefono_empresa' => $telefono_empresa));
 }
开发者ID:bmrpas,项目名称:SHREDDER,代码行数:6,代码来源:TelefonoController.php


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