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


PHP SiteHelpers::getUserIdFromCustomerId方法代码示例

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


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

示例1: dc_addition

 public static function dc_addition($id)
 {
     //get the delivery object
     $delivery_object = DB::table('tb_request_delivery')->where('id', $id)->first();
     $user_id = \SiteHelpers::getUserIdFromCustomerId($delivery_object->cid);
     DB::table('tb_request_delivery')->where('id', $id)->update(['parcel_delivery_code' => \SiteHelpers::delivery_code($user_id)]);
 }
开发者ID:sonoftheweb,项目名称:yallatracking_app,代码行数:7,代码来源:Viewdeliveries.php

示例2: delete_action

 public static function delete_action($ids)
 {
     foreach ($ids as $id) {
         //get the customer ID and User ID
         $delivery_object = DB::table('tb_request_delivery')->where('id', $id)->first();
         $customer_id = $delivery_object->cid;
         $user_id = \SiteHelpers::getUserIdFromCustomerId($customer_id);
         $bill = DB::table('tb_bills')->where('delivery_id', $id)->get();
         if (count($bill) == 1) {
             $bill_amount = $bill[0]->bill;
             //refund now
             if (\SiteHelpers::is_payg_customer()) {
                 DB::table('tb_payg_balance')->where('user_id', $user_id)->increment('balance', $bill_amount);
                 //remove the bill
                 self::remove_bills($id);
             }
         }
     }
 }
开发者ID:sonoftheweb,项目名称:yallatracking_app,代码行数:19,代码来源:Getdeliveries.php

示例3: postSave

 function postSave(Request $request)
 {
     $rules = $this->validateForm();
     $validator = Validator::make($request->all(), $rules);
     if ($validator->passes()) {
         $data = $this->validatePost('tb_viewdeliveries');
         //for Other customers ensure that their limit has not been reached for the selected date
         if (!\SiteHelpers::is_payg_customer(\SiteHelpers::getUserIdFromCustomerId($request->input('cid'))) && \SiteHelpers::check_daily_limit(\SiteHelpers::getUserIdFromCustomerId($request->input('cid'), $request->input('prefered_date_of_delivery')))) {
             return Redirect::to('viewdeliveries?return=' . self::returnUrl())->with('messagetext', 'This user has exceeded his/her daily limit for ' . $request->input('prefered_date_of_delivery'))->with('msgstatus', 'error')->withErrors($validator)->withInput();
         }
         //ensure the delivery is made at the right time
         if (!\SiteHelpers::check_cut_off_time($request->input('parcel_delivery_priority'), $request->input('parcel_pickup_zone'), $request->input('parcel_dropoff_zone'))) {
             return Redirect::to('viewdeliveries?return=' . self::returnUrl())->with('messagetext', 'You cannot make delivery requests at this time')->with('msgstatus', 'error')->withErrors($validator)->withInput();
         }
         //add delivery
         $id = $this->model->insertRow($data, $request->input('id'));
         //update the delivery code using userid
         $this->model->dc_addition($id);
         if ($request->input('id') == '') {
             $delCode = $this->model->get_parcel_delivery_code($id);
             if (\SiteHelpers::is_payg_customer(\SiteHelpers::getUserIdFromCustomerId($request->input('cid')))) {
                 $bill = \SiteHelpers::calc_delivery_fee($delCode);
                 $this->model->add_bill($id, $bill, $request->input('cid'), 'initial');
                 \SiteHelpers::billing_account_types($request->input('cid'), $bill);
             } else {
                 //set the limit table
                 \SiteHelpers::set_deliver_count_for_limit($request->input('cid'), $id, $request->input('prefered_date_of_delivery'));
             }
         }
         //if the delivery is returned
         if ($request->input('status') == '4') {
             if (\SiteHelpers::is_payg_customer(\SiteHelpers::getUserIdFromCustomerId($request->input('cid')))) {
                 $this->model->add_returned_bill($request->input('id'));
                 \SiteHelpers::billing_account_types($request->input('cid'), $this->model->add_returned_bill($request->input('id'), true));
             }
             /*else{
                   \SiteHelpers::set_deliver_count_for_limit($request->input('cid'),$id,$request->input('prefered_date_of_delivery'),'1');
               }*/
         }
         if (!is_null($request->input('apply'))) {
             $return = 'viewdeliveries/update/' . $id . '?return=' . self::returnUrl();
         } else {
             $return = 'viewdeliveries?return=' . self::returnUrl();
         }
         // Insert logs into database
         if ($request->input('id') == '') {
             \SiteHelpers::auditTrail($request, 'New Data with ID ' . $id . ' Has been Inserted !');
         } else {
             \SiteHelpers::auditTrail($request, 'Data with ID ' . $id . ' Has been Updated !');
         }
         return Redirect::to($return)->with('messagetext', \Lang::get('core.note_success'))->with('msgstatus', 'success');
     } else {
         return Redirect::to('viewdeliveries/update/' . $id)->with('messagetext', \Lang::get('core.note_error'))->with('msgstatus', 'error')->withErrors($validator)->withInput();
     }
 }
开发者ID:sonoftheweb,项目名称:yallatracking_app,代码行数:55,代码来源:ViewdeliveriesController.php

示例4: postSave

 function postSave(Request $request)
 {
     $rules = $this->validateForm();
     $validator = Validator::make($request->all(), $rules);
     if ($validator->passes()) {
         $data = $this->validatePost('tb_getdeliveries');
         //for Platinum, Gold, Silver customers ensure that their limit has not been reached for the selected date
         if (!\SiteHelpers::is_payg_customer(\SiteHelpers::getUserIdFromCustomerId($request->input('cid'))) && !\SiteHelpers::check_daily_limit(\SiteHelpers::getUserIdFromCustomerId($request->input('cid'), $request->input('prefered_date_of_delivery')))) {
             return Redirect::to('getdeliveries?return=' . self::returnUrl())->with('messagetext', 'This user has exceeded his/her daily limit for ' . $request->input('prefered_date_of_delivery'))->with('msgstatus', 'error')->withErrors($validator)->withInput();
         }
         //ensure the delivery is made at the right time
         //dd(\SiteHelpers::check_cut_off_time($request->input('parcel_delivery_priority')));
         if (!\SiteHelpers::check_cut_off_time($request->input('parcel_delivery_priority'), $request->input('parcel_pickup_zone'), $request->input('parcel_dropoff_zone'))) {
             return Redirect::to('getdeliveries?return=' . self::returnUrl())->with('messagetext', 'You cannot make delivery requests at this time')->with('msgstatus', 'error')->withErrors($validator)->withInput();
         }
         //add delivery
         $id = $this->model->insertRow($data, $request->input('id'));
         if ($request->input('id') == '') {
             if (\SiteHelpers::is_payg_customer(\SiteHelpers::getUserIdFromCustomerId($request->input('cid')))) {
                 $bill = \SiteHelpers::calc_delivery_fee($request->input('parcel_delivery_code'));
                 //dd($bill);
                 $this->model->add_bill($id, $bill, $request->input('cid'), 'initial');
                 \SiteHelpers::billing_account_types($request->input('cid'), $bill);
             } else {
                 //set the limit table
                 \SiteHelpers::set_deliver_count_for_limit($request->input('cid'), $id, $request->input('prefered_date_of_delivery'));
             }
         }
         if (!is_null($request->input('apply'))) {
             $return = 'getdeliveries/update/' . $id . '?return=' . self::returnUrl();
         } else {
             $return = 'getdeliveries?return=' . self::returnUrl();
         }
         // Insert logs into database
         if ($request->input('id') == '') {
             \SiteHelpers::auditTrail($request, 'New Data with ID ' . $id . ' Has been Inserted !');
         } else {
             \SiteHelpers::auditTrail($request, 'Data with ID ' . $id . ' Has been Updated !');
         }
         $notif = array('url' => url('/viewdeliveries'), 'userid' => '5', 'title' => 'New Delivery Request', 'note' => 'Hi Admin. A user just sent in a delivery request. Have a look.');
         \SximoHelpers::storeNote($notif);
         return Redirect::to($return)->with('messagetext', \Lang::get('core.note_success'))->with('msgstatus', 'success');
     } else {
         return Redirect::to('getdeliveries/update/' . $id)->with('messagetext', \Lang::get('core.note_error'))->with('msgstatus', 'error')->withErrors($validator)->withInput();
     }
 }
开发者ID:sonoftheweb,项目名称:yallatracking_app,代码行数:46,代码来源:GetdeliveriesController.php

示例5: billing_account_types

 public static function billing_account_types($cid, $bill)
 {
     $uid = SiteHelpers::getUserIdFromCustomerId($cid);
     $account_type = DB::table('tb_customers')->where('id', $cid)->pluck('account_type');
     if ($account_type == 4) {
         //subtract costs of delivery from payg account
         $paygbalance = DB::table('tb_payg_balance')->where('user_id', $uid)->pluck('balance');
         $newpaygbalance = $paygbalance - $bill;
         DB::table('tb_payg_balance')->where('user_id', $uid)->update(['balance' => $newpaygbalance]);
     }
 }
开发者ID:sonoftheweb,项目名称:yallatracking_app,代码行数:11,代码来源:SiteHelpers.php


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