AgentLevel.php 743 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class AgentLevel extends Model
  5. {
  6. /**
  7. * 数据库连接名
  8. */
  9. protected $connection = 'mysql';
  10. /**
  11. * 与模型关联的表名
  12. */
  13. protected $table = 'webgame.agent_levels';
  14. /**
  15. * 可批量赋值的属性
  16. */
  17. protected $fillable = [
  18. 'level_name',
  19. 'level',
  20. 'required_referrals',
  21. 'commission_rate'
  22. ];
  23. /**
  24. * 表明模型是否应该被打上时间戳
  25. *
  26. * @var bool
  27. */
  28. public $timestamps = false;
  29. /**
  30. * 获取此级别的用户
  31. */
  32. public function users()
  33. {
  34. return $this->hasMany(AgentUserInfo::class, 'level', 'level');
  35. }
  36. }