ActivityUser.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App\Models;
  3. use App\Constants\Util;
  4. /**
  5. * @property string $activity_id
  6. * @property string $finish_time
  7. * @property string member_id
  8. * @property string title
  9. * @property string status
  10. * @property string sub_title
  11. * @property string detail_image
  12. * @property string start_time
  13. * @property string end_time
  14. * @property string part_in_time
  15. *
  16. */
  17. class ActivityUser extends BaseModel
  18. {
  19. protected $table = 'activity_user';
  20. protected $fillable = ['activity_id', 'finish_time', 'member_id', 'title', 'status', 'sub_title', 'detail_image',
  21. 'start_time', 'end_time', 'part_in_time'];
  22. protected function getDetailImageAttribute($value)
  23. {
  24. return Util::ensureUrl($value);
  25. }
  26. protected function getPartInTimeAttribute($value): string
  27. {
  28. return date('Y-m-d H:i:s', $value);
  29. }
  30. protected function getFinishTimeAttribute($value): string
  31. {
  32. if ($value > 1) {
  33. return date('Y-m-d', $value);
  34. }
  35. return "";
  36. }
  37. protected function getStartTimeAttribute($value): string
  38. {
  39. return date('Y-m-d', $value);
  40. }
  41. protected function getEndTimeAttribute($value): string
  42. {
  43. return date('Y-m-d', $value);
  44. }
  45. }