| Current Path : /var/www/html/brspace/backend/modules/api/models/ |
| Current File : /var/www/html/brspace/backend/modules/api/models/Api.php |
<?php
namespace backend\modules\api\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\behaviors\BlameableBehavior;
use yii\db\Expression;
use yii\db\ActiveRecord;
use asinfotrack\yii2\audittrail\behaviors\AuditTrailBehavior;
/**
* This is the model class for table "dmg_api".
*
* @property int $api_id
* @property string|null $api_code
* @property string|null $api_descr
* @property string|null $api_content
* @property string|null $created_at
* @property int|null $created_by
* @property string|null $updated_at
* @property int|null $updated_by
*/
class Api extends \yii\db\ActiveRecord {
/**
* {@inheritdoc}
*/
public static function tableName() {
return 'api';
}
// public function behaviors() {
// return [
// 'audittrail' => [
// 'class' => AuditTrailBehavior::className(),
// // some of the optional configurations
// 'ignoredAttributes' => ['created_at', 'updated_at'],
// 'consoleUserId' => 1,
// 'attributeOutput' => [
// 'desktop_id' => function ($value) {
// $model = Desktop::findOne($value);
// return sprintf('%s %s', $model->manufacturer, $model->device_name);
// },
// 'last_checked' => 'datetime',
// ],
// ],
// ];
// }
/**
* {@inheritdoc}
*/
public function rules() {
return [
[['api_code', 'api_descr', 'api_content'], 'required'],
[['api_descr', 'api_content'], 'string'],
[['created_at', 'updated_at'], 'safe'],
[['created_by', 'updated_by'], 'integer'],
[['api_code'], 'string', 'max' => 255],
[['api_code'], 'unique'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels() {
return [
'api_id' => Yii::t('app', 'Api ID'),
'api_code' => Yii::t('app', 'Method Name'),
'api_descr' => Yii::t('app', 'API Description'),
'api_content' => Yii::t('app', 'API Souce Code'),
'created_at' => Yii::t('app', 'Created At'),
'created_by' => Yii::t('app', 'Created By'),
'updated_at' => Yii::t('app', 'Updated At'),
'updated_by' => Yii::t('app', 'Updated Dt'),
];
}
}