InviteNewUsersConfigRepository.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. *
  4. *
  5. * @category xxx
  6. * @package PSR
  7. * @subpackage Documentation\API
  8. * @author xxx <xxx@xxx.com>
  9. * @license GPL https://xxx.com
  10. * @link https://xxx.com
  11. * @ctime: 2020/4/14 17:26
  12. */
  13. namespace App\Repositories;
  14. use App\Models\InviteNewUsersConfig;
  15. use Carbon\Carbon;
  16. class InviteNewUsersConfigRepository extends BaseRepository
  17. {
  18. public function __construct(InviteNewUsersConfig $inviteNewUsersConfig)
  19. {
  20. $this->model = $inviteNewUsersConfig;
  21. }
  22. public function getAllByAreaId($area_id){
  23. return $this->model->query()
  24. ->where('status',$this->model::STATUS_OK)
  25. ->where('start_time','<',Carbon::now())
  26. ->where('end_time','>',Carbon::now())
  27. ->where('area_id',$area_id)
  28. ->get();
  29. }
  30. public function getInviteNewUsersConfigByAreaId($area_id){
  31. return $this->model->query()
  32. ->where('status',$this->model::STATUS_OK)
  33. ->where('start_time','<',Carbon::now())
  34. ->where('end_time','>',Carbon::now())
  35. ->where('area_id',$area_id)
  36. ->first();
  37. }
  38. }