12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace app\models;
- use Yii;
- /**
- * This is the model class for table "os_logs".
- *
- * @property int $id
- * @property string $date
- * @property string $section
- * @property string $error_text
- */
- class Logs extends \yii\db\ActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'os_logs';
- }
- public static function getDb()
- {
- return \Yii::$app->slave_db;
- }
-
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['date'], 'safe'],
- //[['section', 'error_text'], 'required'],
- [['error_text'], 'string'],
- //[['section'], 'integer'],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'date' => 'Date',
- 'section' => 'Section',
- 'error_text' => 'Error Text',
- ];
- }
-
- public static function addlog($section,$text) {
-
- $logsModel = new Logs();
- $logsModel->section = $section;
- $logsModel->error_text = $text;
- $logsModel->save();
- //var_dump($logsModel->errors);
-
- }
-
- public function addlogText($er_text = '',$su_text = '', $section = '') {
-
- if ( null == $this->section) {
- $this->section = $section;
- }
- $logsModel = new Logs();
- $logsModel->index_t = $this->index_t;
- $logsModel->section = $this->section;
- $logsModel->error_text = $er_text;
- $logsModel->success_text = $su_text;
- $logsModel->save();
-
- }
- }
|