| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- /**
- * MaterialCategory.php
- * 素材分类模型
- * Created on 2025/1/11 上午9:44
- * @author: hankaige
- */
- namespace app\models\material;
- use yii\behaviors\TimestampBehavior;
- /**
- * This is the model class for table "{{%material_category}}".
- * @property integer $id
- * @property integer $store_id
- * @property string $name
- * @property integer $sort 升序
- * @property integer $status
- */
- class MaterialCategory extends \yii\db\ActiveRecord
- {
- const STATUS_ACTIVE = 1;
- const STATUS_DELETE = 0;
- public static function tableName():string
- {
- return '{{%material_category}}';
- }
- public function behaviors():array
- {
- return [
- [
- // 自动更新创建和更新时间
- 'class' => TimestampBehavior::class,
- 'createdAtAttribute' => 'create_time',
- 'updatedAtAttribute' => 'update_time',
- 'value' => function(){
- return date('Y-m-d H:i:s');
- }
- ],
- ];
- }
- public function rules():array
- {
- return [
- [['store_id','sort','status'],'integer'],
- ['name','string'],
- [['store_id','name'],'required']
- ];
- }
- public function attributeLabels():array
- {
- return [
- 'store_id' => '商城ID',
- 'name' => '分类名称',
- 'sort' => '排序',
- 'status' => '状态'
- ];
- }
- }
|