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


PHP Log::create方法代碼示例

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


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

示例1: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         if ($model->carsubmodelid == 0) {
             CommissionExtraCar::where('commissionextraid', $model->commissionextraid)->where('carmodelid', $model->carmodelid)->delete();
         }
         $model->createdby = Auth::user()->id;
         $model->createddate = date("Y-m-d H:i:s");
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::created(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Add', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::updating(function ($model) {
         if ($model->carsubmodelid == 0) {
             CommissionExtraCar::where('id', '!=', $model->id)->where('commissionextraid', $model->commissionextraid)->where('carmodelid', $model->carmodelid)->delete();
         }
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::updated(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Update', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::deleted(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Delete', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
 }
開發者ID:x-Zyte,項目名稱:nissanhippro,代碼行數:29,代碼來源:CommissionExtraCar.php

示例2: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         $carpreemption = CarPreemption::find($model->carpreemptionid);
         $model->provinceid = $carpreemption->provinceid;
         $model->branchid = $carpreemption->branchid;
         $model->createdby = Auth::user()->id;
         $model->createddate = date("Y-m-d H:i:s");
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::created(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Add', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
         $carpreemption = CarPreemption::find($model->carpreemptionid);
         $carpreemption->status = 2;
         $carpreemption->save();
     });
     static::updating(function ($model) {
         $carpreemption = CarPreemption::find($model->carpreemptionid);
         $model->provinceid = $carpreemption->provinceid;
         $model->branchid = $carpreemption->branchid;
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::updated(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Update', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::deleted(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Delete', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
         $carpreemption = CarPreemption::find($model->carpreemptionid);
         $carpreemption->status = 0;
         $carpreemption->save();
     });
 }
開發者ID:x-Zyte,項目名稱:nissanhippro,代碼行數:35,代碼來源:CancelCarPreemption.php

示例3: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         $carpayment = CarPayment::find($model->carpaymentid);
         $model->provinceid = $carpayment->provinceid;
         $model->branchid = $carpayment->branchid;
         $model->createdby = Auth::user()->id;
         $model->createddate = date("Y-m-d H:i:s");
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::created(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Add', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::updating(function ($model) {
         $carpayment = CarPayment::find($model->carpaymentid);
         $model->provinceid = $carpayment->provinceid;
         $model->branchid = $carpayment->branchid;
         $model->accountingDetailReceiveAndPays()->delete();
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::updated(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Update', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::deleting(function ($model) {
         $model->accountingDetailReceiveAndPays()->delete();
     });
     static::deleted(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Delete', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
 }
開發者ID:x-Zyte,項目名稱:nissanhippro,代碼行數:33,代碼來源:AccountingDetail.php

示例4: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         $model->effectivefrom = date('Y-m-d', strtotime($model->effectivefrom));
         $model->effectiveto = date('Y-m-d', strtotime($model->effectiveto));
         $model->createdby = Auth::user()->id;
         $model->createddate = date("Y-m-d H:i:s");
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::created(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Add', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::updating(function ($model) {
         $model->effectivefrom = date('Y-m-d', strtotime($model->effectivefrom));
         $model->effectiveto = date('Y-m-d', strtotime($model->effectiveto));
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::updated(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Update', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::deleted(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Delete', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
 }
開發者ID:x-Zyte,項目名稱:nissanhippro,代碼行數:27,代碼來源:CommissionSpecial.php

示例5: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         if ($model->isadmin) {
             $model->branchid = null;
             $model->departmentid = null;
             $model->teamid = null;
         } else {
             if ($model->branchid == '') {
                 $model->branchid = null;
             }
             if ($model->departmentid == '') {
                 $model->departmentid = null;
             }
             if ($model->teamid == '') {
                 $model->teamid = null;
             }
         }
         $model->password = bcrypt("nissanhippro");
         $model->createdby = Auth::user()->id;
         $model->createddate = date("Y-m-d H:i:s");
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::created(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Add', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::updating(function ($model) {
         if ($model->isadmin) {
             $model->branchid = null;
             $model->departmentid = null;
             $model->teamid = null;
         } else {
             if ($model->branchid == '') {
                 $model->branchid = null;
             }
             if ($model->departmentid == '') {
                 $model->departmentid = null;
             }
             if ($model->teamid == '') {
                 $model->teamid = null;
             }
         }
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::updated(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Update', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::deleted(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Delete', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
 }
開發者ID:x-Zyte,項目名稱:nhp,代碼行數:54,代碼來源:Employee.php

示例6: authenticate

 /**
  * Handle an authentication attempt.
  *
  * @return Response
  */
 public function authenticate(Request $request)
 {
     $email = Input::get('email');
     $password = Input::get('password');
     $remember = Input::get('remember');
     if (Auth::attempt(['email' => $email, 'password' => $password], $remember)) {
         Log::create(['action' => '登錄係統', 'userid' => Auth::user()->id, 'username' => Auth::user()->name]);
         return redirect()->intended('orders');
     }
     return Redirect::to('/auth/login')->with('errors', array($this->loginUsername() => '用戶名或密碼錯誤'));
 }
開發者ID:cdandy,項目名稱:meta-admin,代碼行數:16,代碼來源:LoginController.php

示例7: log

 public static function log($type, $value, $additional = null, $vars = null)
 {
     $ip = Request::ip();
     $user = Auth::user();
     if ($user) {
         $user_id = $user->id;
     } else {
         $user_id = 0;
     }
     $l = Log::create(['user_id' => $user_id, 'ip' => $ip, 'type' => $type, 'key_value' => $value, 'additional_value' => $additional, 'var' => $vars]);
     return $l;
 }
開發者ID:blozixdextr,項目名稱:adtw,代碼行數:12,代碼來源:LogMapper.php

示例8: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         $model->createdby = Auth::user()->id;
         $model->createddate = date("Y-m-d H:i:s");
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::created(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Add', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
         if ($model->isheadquarter) {
             for ($i = 1; $i <= $model->keyslot; $i++) {
                 $m = new KeySlot();
                 $m->provinceid = $model->provinceid;
                 $m->no = $i;
                 $m->active = true;
                 $m->save();
             }
         }
     });
     static::updating(function ($model) {
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::updated(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Update', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
         if ($model->isheadquarter) {
             $max = KeySlot::where('provinceid', $model->provinceid)->max('no');
             if ($max == null) {
                 $max = 0;
             }
             if ($model->keyslot > $max) {
                 for ($i = $max + 1; $i <= $model->keyslot; $i++) {
                     $m = new KeySlot();
                     $m->provinceid = $model->provinceid;
                     $m->no = $i;
                     $m->active = true;
                     $m->save();
                 }
             } elseif ($model->keyslot < $max) {
                 KeySlot::where('provinceid', $model->provinceid)->where('no', '>', $model->keyslot)->delete();
             }
         }
     });
     static::deleted(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Delete', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
         if ($model->isheadquarter) {
             KeySlot::where('provinceid', $model->provinceid)->delete();
         }
     });
 }
開發者ID:x-Zyte,項目名稱:nhp,代碼行數:52,代碼來源:Branch.php

示例9: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         $model->issold = false;
         $model->isregistered = false;
         $model->isdelivered = false;
         $model->dodate = date('Y-m-d', strtotime($model->dodate));
         $model->receiveddate = date('Y-m-d', strtotime($model->receiveddate));
         $model->createdby = Auth::user()->id;
         $model->createddate = date("Y-m-d H:i:s");
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::created(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Add', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
         $rs = DB::select('call running_number("' . $model->provinceid . date("Y") . '","' . $model->receivetype . '")');
         $model->no = $rs[0]->no;
         $min = KeySlot::where('provinceid', $model->provinceid)->where('active', true)->min('no');
         if ($min == null) {
             $branch = Branch::where('provinceid', $model->provinceid)->where('isheadquarter', true)->first();
             $branch->keyslot = $branch->keyslot + 1;
             $branch->save();
             $model->keyno = $branch->keyslot;
         } else {
             $model->keyno = $min;
         }
         $model->save();
         KeySlot::where('provinceid', $model->provinceid)->where('no', $model->keyno)->update(['active' => false]);
     });
     static::updating(function ($model) {
         $model->dodate = date('Y-m-d', strtotime($model->dodate));
         $model->receiveddate = date('Y-m-d', strtotime($model->receiveddate));
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::updated(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Update', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::deleted(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Delete', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
         if ($model->receivecarfilepath != '') {
             File::delete(public_path() . $model->receivecarfilepath);
         }
         if ($model->deliverycarfilepath != '') {
             File::delete(public_path() . $model->deliverycarfilepath);
         }
         KeySlot::where('provinceid', $model->provinceid)->where('no', $model->keyno)->update(['active' => true]);
     });
 }
開發者ID:x-Zyte,項目名稱:nhp,代碼行數:50,代碼來源:Car.php

示例10: boot

 public static function boot()
 {
     parent::boot();
     static::updating(function ($model) {
         if ($model->returncashpledgedate != null && $model->returncashpledgedate != '') {
             $model->returncashpledgedate = date('Y-m-d', strtotime($model->returncashpledgedate));
         } else {
             $model->returncashpledgedate = null;
         }
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::updated(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Update', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
 }
開發者ID:x-Zyte,項目名稱:nissanhippro,代碼行數:16,代碼來源:ReturnCashPledgeRedLabel.php

示例11: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         if ($model->occupationid == '') {
             $model->occupationid = null;
         }
         if ($model->districtid == '') {
             $model->districtid = null;
         }
         if ($model->amphurid == '') {
             $model->amphurid = null;
         }
         if ($model->addprovinceid == '') {
             $model->addprovinceid = null;
         }
         $model->createdby = Auth::user()->id;
         $model->createddate = date("Y-m-d H:i:s");
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::created(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Add', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::updating(function ($model) {
         if ($model->occupationid == '') {
             $model->occupationid = null;
         }
         if ($model->districtid == '') {
             $model->districtid = null;
         }
         if ($model->amphurid == '') {
             $model->amphurid = null;
         }
         if ($model->addprovinceid == '') {
             $model->addprovinceid = null;
         }
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::updated(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Update', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::deleted(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Delete', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
 }
開發者ID:x-Zyte,項目名稱:nhp,代碼行數:47,代碼來源:Customer.php

示例12: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         $model->customerid = null;
         $model->carid = null;
         $model->deposit = null;
         if (!strpos($model->no, "-")) {
             $model->no = substr_replace($model->no, "-", strlen($model->no) - 4, 0);
         }
         $model->createdby = Auth::user()->id;
         $model->createddate = date("Y-m-d H:i:s");
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::created(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Add', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::updating(function ($model) {
         if ($model->customerid == '') {
             $model->customerid = null;
         }
         if ($model->carid == '') {
             $model->carid = null;
         }
         if ($model->deposit == '') {
             $model->deposit = null;
         }
         if (!strpos($model->no, "-")) {
             $model->no = substr_replace($model->no, "-", strlen($model->no) - 4, 0);
         }
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::updated(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Update', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::deleted(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Delete', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
 }
開發者ID:x-Zyte,項目名稱:nissanhippro,代碼行數:41,代碼來源:RedLabel.php

示例13: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         if ($model->effectiveto != null && $model->effectiveto != '') {
             $model->effectiveto = date('Y-m-d', strtotime($model->effectiveto));
         }
         $model->effectivefrom = date('Y-m-d', strtotime($model->effectivefrom));
         $model->sellingpricewithaccessories = $model->sellingprice + $model->margin;
         $model->execusivetotalmargincampaing = $model->margin + $model->execusiveinternal + $model->execusivecampaing;
         $model->totalmargincampaing = $model->margin + $model->internal + $model->campaing;
         $model->createdby = Auth::user()->id;
         $model->createddate = date("Y-m-d H:i:s");
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::created(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Add', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::updating(function ($model) {
         if ($model->effectiveto != null && $model->effectiveto != '') {
             $model->effectiveto = date('Y-m-d', strtotime($model->effectiveto));
         }
         $model->effectivefrom = date('Y-m-d', strtotime($model->effectivefrom));
         $model->sellingpricewithaccessories = $model->sellingprice + $model->margin;
         $model->execusivetotalmargincampaing = $model->margin + $model->execusiveinternal + $model->execusivecampaing;
         $model->totalmargincampaing = $model->margin + $model->internal + $model->campaing;
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::updated(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Update', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::deleted(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Delete', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
 }
開發者ID:x-Zyte,項目名稱:nissanhippro,代碼行數:37,代碼來源:Pricelist.php

示例14: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         $carpreemption = CarPreemption::find($model->carpreemptionid);
         $model->provinceid = $carpreemption->provinceid;
         $model->branchid = $carpreemption->branchid;
         if ($model->insurancecompanyid == '') {
             $model->insurancecompanyid = null;
         }
         if ($model->capitalinsurance == '') {
             $model->capitalinsurance = null;
         }
         if ($model->buyerpay == '') {
             $model->buyerpay = null;
         }
         if ($model->overdue == '') {
             $model->overdue = null;
         }
         if ($model->overdueinterest == '') {
             $model->overdueinterest = null;
         }
         if ($model->totaloverdue == '') {
             $model->totaloverdue = null;
         }
         if ($model->paybytype == '') {
             $model->paybytype = null;
         }
         if ($model->paybyotherdetails == '') {
             $model->paybyotherdetails = null;
         }
         if ($model->overdueinstallments == '') {
             $model->overdueinstallments = null;
         }
         if ($model->overdueinstallmentdate1 == '') {
             $model->overdueinstallmentdate1 = null;
         }
         if ($model->overdueinstallmentamount1 == '') {
             $model->overdueinstallmentamount1 = null;
         }
         if ($model->overdueinstallmentdate2 == '') {
             $model->overdueinstallmentdate2 = null;
         }
         if ($model->overdueinstallmentamount2 == '') {
             $model->overdueinstallmentamount2 = null;
         }
         if ($model->overdueinstallmentdate3 == '') {
             $model->overdueinstallmentdate3 = null;
         }
         if ($model->overdueinstallmentamount3 == '') {
             $model->overdueinstallmentamount3 = null;
         }
         if ($model->overdueinstallmentdate4 == '') {
             $model->overdueinstallmentdate4 = null;
         }
         if ($model->overdueinstallmentamount4 == '') {
             $model->overdueinstallmentamount4 = null;
         }
         if ($model->overdueinstallmentdate5 == '') {
             $model->overdueinstallmentdate5 = null;
         }
         if ($model->overdueinstallmentamount5 == '') {
             $model->overdueinstallmentamount5 = null;
         }
         if ($model->overdueinstallmentdate6 == '') {
             $model->overdueinstallmentdate6 = null;
         }
         if ($model->overdueinstallmentamount6 == '') {
             $model->overdueinstallmentamount6 = null;
         }
         if ($model->oldcarbuyername == '') {
             $model->oldcarbuyername = null;
         }
         if ($model->oldcarpayamount == '') {
             $model->oldcarpayamount = null;
         }
         if ($model->oldcarpaytype == '') {
             $model->oldcarpaytype = null;
         }
         if ($model->oldcarpaydate == '') {
             $model->oldcarpaydate = null;
         }
         if ($model->payeeemployeeid == '') {
             $model->payeeemployeeid = null;
         }
         if ($model->deliverycarbookno == '') {
             $model->deliverycarbookno = null;
         }
         if ($model->deliverycarno == '') {
             $model->deliverycarno = null;
         }
         if ($model->deliverycardate == '') {
             $model->deliverycardate = null;
         }
         $model->createdby = Auth::user()->id;
         $model->createddate = date("Y-m-d H:i:s");
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::created(function ($model) {
//.........這裏部分代碼省略.........
開發者ID:x-Zyte,項目名稱:nissanhippro,代碼行數:101,代碼來源:CarPayment.php

示例15: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         if ($model->occupationid == '') {
             $model->occupationid = null;
         }
         if ($model->districtid == '') {
             $model->districtid = null;
         }
         if ($model->amphurid == '') {
             $model->amphurid = null;
         }
         if ($model->addprovinceid == '') {
             $model->addprovinceid = null;
         }
         if ($model->birthdate != null && $model->birthdate != '') {
             $model->birthdate = date('Y-m-d', strtotime($model->birthdate));
         } else {
             $model->birthdate = null;
         }
         //$model->isreal = false;
         $model->statusexpect = 0;
         $model->createdby = Auth::user()->id;
         $model->createddate = date("Y-m-d H:i:s");
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::created(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Add', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
     static::updating(function ($model) {
         if ($model->occupationid == '') {
             $model->occupationid = null;
         }
         if ($model->districtid == '') {
             $model->districtid = null;
         }
         if ($model->amphurid == '') {
             $model->amphurid = null;
         }
         if ($model->addprovinceid == '') {
             $model->addprovinceid = null;
         }
         if ($model->birthdate != null && $model->birthdate != '') {
             $model->birthdate = date('Y-m-d', strtotime($model->birthdate));
         } else {
             $model->birthdate = null;
         }
         $model->modifiedby = Auth::user()->id;
         $model->modifieddate = date("Y-m-d H:i:s");
     });
     static::updated(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Update', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
         if ($model->statusexpect != 1) {
             CustomerExpectation::where('customerid', $model->id)->where('active', true)->update(['active' => false]);
         }
     });
     static::deleted(function ($model) {
         Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Delete', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]);
     });
 }
開發者ID:x-Zyte,項目名稱:nissanhippro,代碼行數:62,代碼來源:Customer.php


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