Commit d98aa8a3 authored by xiabin's avatar xiabin

添加代码

parent 9d0befab
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\redis\ActiveRecord;
/**
* This is the model class for table "course".
*
* @property integer $id
* @property integer $user_id
* @property integer $classed_id
* @property string $avatar
* @property string $name
* @property integer $price
* @property integer $free_time
* @property string $intro
* @property string $preview_pic
* @property integer $recommend
* @property integer $status
* @property integer $created_at
* @property integer $updated_at
*/
class Course extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'course';
}
/**
* @inheritdoc
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'],
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
],
// if you're using datetime instead of UNIX timestamp:
// 'value' => new Expression('NOW()'),
],];
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['user_id', 'classed_id', 'avatar', 'name', 'price', 'free_time', 'intro', 'preview_pic'], 'required'],
[['user_id', 'classed_id', 'price', 'free_time', 'recommend', 'status', 'created_at', 'updated_at'], 'integer'],
[['intro'], 'string'],
[['avatar', 'preview_pic'], 'string', 'max' => 255],
[['name'], 'string', 'max' => 32],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'user_id' => 'User ID',
'classed_id' => 'Classed ID',
'avatar' => 'Avatar',
'name' => 'Name',
'price' => 'Price',
'free_time' => 'Free Time',
'intro' => 'Intro',
'preview_pic' => 'Preview Pic',
'recommend' => '0 表示推荐 1推荐',
'status' => '0 未审核 1 审核通过 2 审核不通过 3 锁定 ',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment