當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Customer::id方法代碼示例

本文整理匯總了PHP中app\models\Customer::id方法的典型用法代碼示例。如果您正苦於以下問題:PHP Customer::id方法的具體用法?PHP Customer::id怎麽用?PHP Customer::id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Customer的用法示例。


在下文中一共展示了Customer::id方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: detail

 /**
  * Display a customer
  *
  * @return Response
  */
 public function detail($id = null)
 {
     $result = \App\Models\Customer::id($id)->with(['sales', 'myreferrals', 'myreferrals.user'])->first();
     if ($result) {
         return new JSend('success', (array) $result->toArray());
     }
     return new JSend('error', (array) Input::all(), 'ID Tidak Valid.');
 }
開發者ID:ThunderID,項目名稱:SHOP-API,代碼行數:13,代碼來源:CustomerController.php

示例2: invite

 /**
  * Invite friend
  *
  * @return Response
  */
 public function invite($user_id = null)
 {
     if (!Input::has('invitations')) {
         return new JSend('error', (array) Input::all(), 'Tidak ada data invitations.');
     }
     $invitations = Input::get('invitations');
     $errors = new MessageBag();
     DB::beginTransaction();
     //1. Store mail
     if (!$errors->count()) {
         foreach ($invitations as $key => $value) {
             if (!$errors->count()) {
                 $log_data = new \App\Models\UserInvitationLog();
                 $log_rules = ['email' => 'required|email'];
                 $validator = Validator::make($value, $log_rules);
                 //if there was log and validator false
                 if (!$validator->passes()) {
                     $errors->add('log', $validator->errors());
                 } else {
                     $value['user_id'] = $user_id;
                     $log_data = $log_data->fill($value);
                     if (!$log_data->save()) {
                         $errors->add('Log', $log_data->getError());
                     }
                 }
             }
         }
     }
     if ($errors->count()) {
         DB::rollback();
         return new JSend('error', (array) Input::all(), $errors);
     }
     DB::commit();
     $final_costumer = \App\Models\Customer::id($user_id)->with(['myreferrals', 'myreferrals.user'])->first()->toArray();
     return new JSend('success', (array) $final_costumer);
 }
開發者ID:ThunderID,項目名稱:SHOP-API,代碼行數:41,代碼來源:MyController.php

示例3: change

 /**
  * Change password
  *
  * @return Response
  */
 public function change()
 {
     if (!Input::has('email') || !Input::has('password')) {
         return new JSend('error', (array) Input::all(), 'Tidak ada data customer.');
     }
     $email = Input::get('email');
     $password = Input::get('password');
     $errors = new MessageBag();
     DB::beginTransaction();
     //1. Check Email
     $customer_data = \App\Models\Customer::email($email)->notSSOMedia(['facebook'])->first();
     if (!$customer_data) {
         $errors->add('Customer', 'Email tidak valid.');
     } elseif (empty($customer_data->reset_password_link)) {
         $errors->add('Customer', 'Email tidak valid.');
     } else {
         //if validator passed, save customer
         $customer_data = $customer_data->fill(['reset_password_link' => '', 'password' => $password, 'date_of_birth' => strtotime($customer_data['date_of_birth']) ? $customer_data['date_of_birth']->format('Y-m-d H:i:s') : '']);
         if (!$customer_data->save()) {
             $errors->add('Customer', $customer_data->getError());
         }
     }
     if ($errors->count()) {
         DB::rollback();
         return new JSend('error', (array) Input::all(), $errors);
     }
     DB::commit();
     $final_customer = \App\Models\Customer::id($customer_data['id'])->first()->toArray();
     return new JSend('success', (array) $final_customer);
 }
開發者ID:ThunderID,項目名稱:SHOP-API,代碼行數:35,代碼來源:AuthController.php


注:本文中的app\models\Customer::id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。