UserPunish.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App\Module\Ulogic\Models;
  3. use UCore\ModelCore;
  4. use App\Module\Ulogic\Enum\PUNISH_TYPE;
  5. use Illuminate\Database\Eloquent\Relations\HasOne;
  6. /**
  7. * 用户 惩罚(违规记录)
  8. * punish
  9. *
  10. * field start
  11. * @property int $id
  12. * @property int $user_id 用户ID
  13. * @property \App\Module\Ulogic\Enum\PUNISH_TYPE $type 类型
  14. * @property \Carbon\Carbon $created_at
  15. * @property \Carbon\Carbon $updated_at
  16. * @property string $desc 描述
  17. * @property int $level 惩罚等级
  18. * @property \Carbon\Carbon $deleted_at
  19. * @property int $admin_id 做出惩罚的管理员ID
  20. * field end
  21. *
  22. *
  23. *
  24. *
  25. */
  26. class UserPunish extends ModelCore
  27. {
  28. protected $table = 'user_punishs';
  29. // attrlist start
  30. protected $fillable = [
  31. 'id',
  32. 'user_id',
  33. 'type',
  34. 'desc',
  35. 'level',
  36. 'admin_id',
  37. ];
  38. // attrlist end
  39. protected $casts = [
  40. 'type' => PUNISH_TYPE::class
  41. ];
  42. public function user(): HasOne
  43. {
  44. return $this->hasOne(\App\Module\User\Models\User::class, 'id', 'user_id');
  45. }
  46. }