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


PHP models\Log类代码示例

本文整理汇总了PHP中app\models\Log的典型用法代码示例。如果您正苦于以下问题:PHP Log类的具体用法?PHP Log怎么用?PHP Log使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: newLog

 public static function newLog($type, $msg)
 {
     $log = new Log();
     $log->type = $type;
     $log->msg = $msg;
     $log->created_time = time();
     return $log->save();
 }
开发者ID:NothingToDoCN,项目名称:ss-panel,代码行数:8,代码来源:Logger.php

示例2: actionMessage

 public function actionMessage()
 {
     $model = new Log();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect($model->goal->url(['#' => 'log']));
     } else {
         throw new ErrorException('Cannot add message');
     }
 }
开发者ID:sapozhkov,项目名称:goal,代码行数:9,代码来源:GoalController.php

示例3: updateLog

 public function updateLog()
 {
     $model = Log::findOne($this->id);
     if (!$model) {
         $model = new Log();
         $model->source_id = $this->id;
     }
     $model->updated = date("Y-m-d H:i:s");
     return $model->save();
 }
开发者ID:mamontovdmitriy,项目名称:aaaaa,代码行数:10,代码来源:Source.php

示例4: afterSave

 public function afterSave($insert, $changedAttributes)
 {
     parent::afterSave($insert, $changedAttributes);
     $this->calculateItemsLeft($changedAttributes);
     $log = new Log();
     if ($insert) {
         $log->saveDatabaseOperation('create', $this->tableName(), $this->id);
     } else {
         $log->saveDatabaseOperation('update', $this->tableName(), $this->id);
     }
 }
开发者ID:edarkzero,项目名称:mi_taller,代码行数:11,代码来源:PersonItem.php

示例5: post_edit_log_event

 public function post_edit_log_event(Request $request, Log $log, LogEvent $log_event, Admin $admin)
 {
     $validation_rules = $log->getValidationRules();
     $validation_messages = $admin->getValidationMessagesEditUser();
     $this->validate($request, $validation_rules, $validation_messages);
     $log_event = $log_event->find($request->log_event_id);
     $log_event->name = $request->name;
     $arr_request = array();
     $arr_request['name'] = $request->name;
     $log_event->save();
     $log_event_id = $log_event->id;
     $data = $log->getDataArray($arr_request, Auth::id(), $log_event_id, $this->arr_logged_in_user);
     return view('log/edit_log_event_results')->with('data', $data);
 }
开发者ID:jenniferbradley49,项目名称:testing_app_two,代码行数:14,代码来源:LogController.php

示例6: actionIndex

 /**
  * @return string
  */
 public function actionIndex()
 {
     $low_stock_items = Item::find()->where('quantity >= 1 AND quantity <= 10')->all();
     $empty_stock_items = Item::find()->where('quantity = 0')->all();
     $logs = Log::find()->orderBy('created_at DESC')->limit(10)->all();
     return $this->render('index', ['low_stock_items' => $low_stock_items, 'empty_stock_items' => $empty_stock_items, 'logs' => $logs]);
 }
开发者ID:edarkzero,项目名称:mi_taller,代码行数:10,代码来源:SiteController.php

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: findModel

 /**
  * Finds the Log model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Log the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Log::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
开发者ID:heartshare,项目名称:yii2-crazydb-blog,代码行数:15,代码来源:LogController.php

示例12: calculateSum

 public static function calculateSum()
 {
     /** @var Collection $lastSuccessCollection */
     $lastSuccessCollection = Collection::find()->where(['is_fulfilled' => true])->orderBy(['date' => SORT_DESC])->limit(1)->one();
     if (is_null($lastSuccessCollection)) {
         return Log::calculateSum();
     }
     return Log::calculateSum($lastSuccessCollection->date);
 }
开发者ID:nthrnth,项目名称:catering-terminal,代码行数:9,代码来源:Collection.php

示例13: actionUpdate

 /**
  * Updates an existing Equipment model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param string $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $model->room_id = $model->location->room_id;
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         //Las siguientes líneas de código almacenan en la tabla Log información de acerca de las actualizaciones en los equipos
         $modelLog = new Log();
         $modelLog->user_id = Yii::$app->user->id;
         $modelLog->date = new \yii\db\Expression('NOW()');
         $modelLog->log_type_id = 3;
         $modelLog->equipment_id = $model->id;
         $modelLog->location_id = $model->location_id;
         $modelLog->equipment_status_id = $model->equipment_status_id;
         $modelLog->save();
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }
开发者ID:rodespsan,项目名称:FMAT-SAECC,代码行数:25,代码来源:EquipmentController.php

示例14: getTestCatIdByName

 /**
  * Given the test category name we return the test category ID
  *
  * @param $testcategory - the name of the test category
  */
 public static function getTestCatIdByName($testCategory)
 {
     try {
         $testCatId = TestCategory::where('name', 'like', $testCategory)->firstOrFail();
         return $testCatId->id;
     } catch (ModelNotFoundException $e) {
         Log::error("The test category ` {$testCategory} ` does not exist:  " . $e->getMessage());
         //TODO: send email?
         return null;
     }
 }
开发者ID:echiteri,项目名称:iBLIS,代码行数:16,代码来源:TestCategory.php

示例15: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Log::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'equipment_id' => $this->equipment_id, 'user_id' => $this->user_id, 'status_id' => $this->status_id, 'date' => $this->date, 'room_id' => $this->room_id, 'log_type_id' => $this->log_type_id]);
     $query->andFilterWhere(['like', 'location', $this->location]);
     return $dataProvider;
 }
开发者ID:ricardo1121,项目名称:FMAT-SAECC,代码行数:18,代码来源:LogSearch.php


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