| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace app\models;
- use Yii;
- use yii\behaviors\TimestampBehavior;
- use yii\db\ActiveRecord;
- class VideoCat extends ActiveRecord
- {
- const STATUS_ON = 1;
- const STATUS_OFF = 0;
- const IS_DELETE = 1;
- const IS_NOT_DELETE = 0;
- public function behaviors()
- {
- return [
- [
- 'class' => TimestampBehavior::className(),
- 'attributes' => [
- ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'],
- ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
- ],
- ],
- ];
- }
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%video_cat}}'; // 数据库表名
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['store_id', 'name',], 'required'],
- [['store_id', 'status', 'is_delete'], 'integer'],
- [['created_at', 'updated_at'], 'safe'],
- [['name'], 'string', 'max' => 255],
- [['status', 'is_delete'], 'default', 'value' => 0]
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => 'Store ID',
- 'name' => 'Name',
- 'status' => 'Status',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- 'is_delete' => 'Is Delete',
- ];
- }
- }
|