* @license GPL https://xxx.com * @link https://xxx.com * @ctime: 2020/4/14 17:26 */ namespace App\Repositories; use App\Models\InviteNewUsersConfig; use Carbon\Carbon; class InviteNewUsersConfigRepository extends BaseRepository { public function __construct(InviteNewUsersConfig $inviteNewUsersConfig) { $this->model = $inviteNewUsersConfig; } public function getAllByAreaId($area_id){ return $this->model->query() ->where('status',$this->model::STATUS_OK) ->where('start_time','<',Carbon::now()) ->where('end_time','>',Carbon::now()) ->where('area_id',$area_id) ->get(); } public function getInviteNewUsersConfigByAreaId($area_id){ return $this->model->query() ->where('status',$this->model::STATUS_OK) ->where('start_time','<',Carbon::now()) ->where('end_time','>',Carbon::now()) ->where('area_id',$area_id) ->first(); } }