PairActivityManager.php 711 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App\Managers;
  3. use App\Models\Fpdx\ActivityModel;
  4. /**
  5. * 分配对象匹配活动
  6. * Class PairActivityManager
  7. * @package App\Managers
  8. */
  9. class PairActivityManager
  10. {
  11. protected ActivityModel $activityModel;
  12. public function __construct(ActivityModel $activityModel)
  13. {
  14. $this->$activityModel = $activityModel;
  15. }
  16. /**
  17. * 获取报名中的活动
  18. * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
  19. */
  20. public function getEnrollingActivity()
  21. {
  22. $activity = $this->activityModel->where('signbegin_time', '<', time())->where('signend_time', '>', time())->first();
  23. return $activity;
  24. }
  25. }