| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- /**
- * MchBrands.php
- * todo 文件描述
- * Created on 2025/5/13 08:49
- * @author: hankaige
- */
- namespace app\models;
- use yii\behaviors\TimestampBehavior;
- class MchBrands extends \yii\db\ActiveRecord
- {
- CONST NOT_DELETE = 0;
- CONST IS_DELETE = 1;
- CONST STATUS_ON = 1;
- CONST STATUS_OFF = 0;
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%mch_brands}}';
- }
- public function rules()
- {
- return [
- [['store_id', 'sort', 'is_delete', 'status', 'created_at', 'updated_at'],'integer'],
- [['name'], 'string'],
- [['store_id', 'user_id', 'name'], 'required'],
- ];
- }
- public function behaviors()
- {
- return [
- [
- 'class' => TimestampBehavior::class,
- ]
- ];
- }
- public function getUser(){
- return $this->hasOne(User::class, ['id' => 'user_id'])->select(['id', 'username', 'nickname', 'avatar_url']);
- }
- }
|