| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Module\Promotion\Models;
- use App\Module\Promotion\Enums\TALENT_LEVEL;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- use UCore\ModelCore;
- /**
- * 达人等级
- *
- * field start
- * field end
- */
- class PromotionUserTalent extends ModelCore
- {
- /**
- * 与模型关联的表名
- *
- * @var string
- */
- protected $table = 'promotion_user_talents';
- // attrlist start
- protected $fillable = [
- ];
- // 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(PromotionTalentConfig::class, 'talent_level', 'level');
- }
- }
|