| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace App\Module\Team\Models;
- use App\Module\Team\Enums\TALENT_LEVEL;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- use UCore\ModelCore;
- /**
- * 达人等级
- *
- * field start
- * @property int $id 主键ID
- * @property int $user_id 用户ID
- * @property \App\Module\Team\Enums\TALENT_LEVEL $talent_level 达人等级:0无,1初级,2中级,3高级,4资深,5顶级
- * @property int $direct_count 直推人数
- * @property int $team_count 团队总人数
- * @property \Carbon\Carbon $created_at 创建时间
- * @property \Carbon\Carbon $updated_at 更新时间
- * field end
- */
- class TeamUserTalent extends ModelCore
- {
- /**
- * 与模型关联的表名
- *
- * @var string
- */
- protected $table = 'team_user_talents';
- // attrlist start
- protected $fillable = [
- 'id',
- 'user_id',
- 'talent_level',
- 'direct_count',
- 'team_count',
- ];
- // attrlist end
- /**
- * 应该被转换为原生类型的属性
- *
- * @var array
- */
- protected $casts = [
- 'talent_level' => TALENT_LEVEL::class,
- ];
- /**
- * 获取用户信息
- *
- * @return BelongsTo
- */
- public function user()
- {
- return $this->belongsTo('App\Models\User', 'user_id');
- }
- /**
- * 获取达人等级配置
- *
- * @return BelongsTo
- */
- public function config()
- {
- return $this->belongsTo(TeamTalentConfig::class, 'talent_level', 'level');
- }
- }
|