cxgj/models/Coach.php
2023-11-27 09:45:13 +08:00

91 lines
2.7 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "{{%coach}}".
*
* @property int $id
* @property string $mobile_phone 教练手机号
* @property string|null $title 头衔
* @property string|null $content 教练介绍
* @property int $coache_begin_time 开始执教时间
* @property string|null $coach_photo 教练照片
* @property string|null $qualification 资格证书
* @property int $status 状态 1-正常 0-关闭
* @property int $store_id 门店ID
* @property int $created_at 添加时间
* @property int $updated_at 修改时间
* @property int $is_delete 是否删除0=否1=是
* @property int $deleted_at 删除时间
* @property string $number 教练编号
* @property int $user_id 用户id
* @property string|null $desc 简介
*/
class Coach extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return '{{%coach}}';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['mobile_phone', 'coache_begin_time', 'store_id', 'user_id'], 'required'],
[['content', 'desc'], 'string'],
[['coache_begin_time', 'status', 'store_id', 'created_at', 'updated_at', 'is_delete', 'deleted_at', 'user_id'], 'integer'],
[['mobile_phone'], 'string', 'max' => 128],
[['desc'], 'string', 'max' => 255],
[['title', 'number'], 'string', 'max' => 50],
[['coach_photo', 'qualification'], 'string', 'max' => 2048],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'mobile_phone' => '教练手机号',
'title' => '头衔',
'content' => '教练介绍',
'coache_begin_time' => '开始执教时间',
'coach_photo' => '教练照片',
'qualification' => '资格证书',
'status' => '状态 1-正常 0-关闭',
'store_id' => '门店ID',
'created_at' => '添加时间',
'updated_at' => '修改时间',
'is_delete' => '是否删除0=否1=是',
'deleted_at' => '删除时间',
'number' => '教练编号',
'user_id' => '用户id',
'desc' => '用户id',
];
}
public static function statusLabels()
{
return [
'0' => '离职',
'1' => '在职',
];
}
public function getUser()
{
return $this->hasOne(User::className(), ['id' => 'user_id'])->where(['is_delete' => 0]);
}
}