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


PHP Space::create方法代码示例

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


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

示例1: register

 public function register(array $input = array())
 {
     $customrules = ['email' => 'required|email|unique:user,email'];
     $input['type'] = isset($input['type']) ? $input['type'] : 'user';
     $input['via'] = isset($input['via']) ? $input['via'] : 'register';
     $input['signup_ref'] = isset($input['signup_ref']) ? $input['signup_ref'] : null;
     $input['ref_code'] = $this->_refCodeGenerator();
     $validation = $this->model->validate($input, $customrules);
     if ($validation->passes()) {
         $user = $this->model->create($input);
         $this->_sendWelcomeMail($input);
         if ($input['signup_ref'] != null) {
             \Space::create(['user_id' => $user->id, 'type' => 'credit', 'nominal' => \Config::get('thankspace.space_credit.signup'), 'keterangan' => 'Space Credit for sign up from link referral']);
         }
         $this->_sendAdminNewCustomerMail($user->id);
         if ($input['via'] != 'admin') {
             $auth = $this->_handleLogin($user->id);
             return $auth;
         } else {
             return true;
         }
     } else {
         $this->setErrors($validation->messages()->all(':message'));
         return false;
     }
 }
开发者ID:rizalafani,项目名称:thankspace,代码行数:26,代码来源:UserRepo.php

示例2: GetInvoiceAlmostExpired

 /**
  * Get Storage Query, for get available storage in whare house
  * and create new invoice for almost expired storage period,
  * send mail and return stuff. this function processed with cron job
  *
  * @return array $data
  */
 public function GetInvoiceAlmostExpired()
 {
     $interval_info = [-7, -3, 0, 1];
     $interval_returned = 3;
     $orderPayments = $this->_GetStorages()->where('order.is_returned', 0)->where('payment_1.status', 2)->where('order_schedule.status', 1)->whereNull('order_stuff.return_schedule_id')->having('expired_on', '>=', $interval_info[0])->get();
     $data = $this->_getInvoiceInfo($orderPayments);
     foreach ($data as $d) {
         $temp = $d;
         if (in_array($temp['expired_on'], $interval_info)) {
             $lunas = false;
             // langsung lunas
             // cek, apakah sudah punya invoice baru apa tidak. jika tidak, buatkan !
             if ($temp['next_invoice'] == null) {
                 // ambil space credit user_id
                 $space_credit = app('UserRepo')->getCustomerSpaceCredit($temp['user_id']);
                 // ambil total biaya
                 $totalBiaya = getTotalFromCountStuff($temp['stuff']);
                 // ambil input new_invoice_input ( order_payment )
                 $newPayment = $temp['new_invoice_input'];
                 if ($space_credit != 0) {
                     if ($space_credit >= $totalBiaya) {
                         $newPayment += ['space_credit_used' => $totalBiaya, 'status' => '2'];
                         $lunas = true;
                     } else {
                         $newPayment += ['space_credit_used' => $space_credit];
                     }
                 }
                 // buat order baru
                 $newInvoice = $this->_save_orderPayment($temp['order_id'], $newPayment);
                 $temp['next_invoice'] = $newInvoice->code;
                 $temp['new_invoice'] = $newInvoice;
                 // insert space debet jika $space_credit_used != 0
                 if ($newInvoice->space_credit_used != 0) {
                     \Space::create(['user_id' => $temp['user_id'], 'type' => 'debet', 'nominal' => $newInvoice->space_credit_used, 'keterangan' => 'Credit used for purchases invoice #' . $newInvoice->code]);
                 }
             }
             if ($lunas) {
                 // kirim email langsung lunas
                 $this->_sendRecurringInvoiceLunasMail($temp);
             } else {
                 // kirim email invoice expired & invoice baru
                 $this->_sendRecurringInvoiceMail($temp);
             }
         } elseif ($temp['expired_on'] == $interval_returned) {
             // lakukan pengembalian barang
             $returnScheduleInput = ['user_id' => $temp['user_id'], 'order_id' => $temp['order_id'], 'return_date' => \Carbon\Carbon::parse($temp['expired_date'])->addDays(4)->format('Y-m-d'), 'return_time' => '08:00am - 10:00am', 'stuffs' => explode(',', implode(',', array_column($temp['stuff'], 'ids'))), 'city_id' => '', 'other_address' => '', 'status' => 0];
             $this->createReturnSchedule($returnScheduleInput);
             $_newInvoice = $temp['new_invoice'];
             //hapus invoice baru yang dibuat
             \OrderPayment::where('code', $_newInvoice->code)->delete();
             // cek apakah invoice baru menggunakan space credit, jika iya, hapus space debet nya untuk invoice ini.
             if ($_newInvoice->space_credit_used != 0) {
                 \Space::where('keterangan', 'like', '%#' . $_newInvoice->code . '%')->delete();
             }
             // kirim email pengembalian barang
             $this->_sendRecurringInvoiceKirimBarangMail($temp);
         }
     }
     return $data;
 }
开发者ID:rizalafani,项目名称:thankspace,代码行数:67,代码来源:OrderRepo.php


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