@@ -14,4 +14,15 @@ class OpeningRepositoryQuery extends AbstractRepositoryQuery | |||
{ | |||
parent::__construct($repository, 'opening', $paginator); | |||
} | |||
public function filterByToday() | |||
{ | |||
return $this->filterByDay(date('N')); | |||
} | |||
public function filterByDay(int $day) | |||
{ | |||
return $this->andWhereEqual('day', $day); | |||
} | |||
} |
@@ -33,4 +33,11 @@ class OpeningStore extends AbstractStore | |||
{ | |||
return $query; | |||
} | |||
public function getOneToday($query = null) | |||
{ | |||
$query = $this->createDefaultQuery($query); | |||
$query->filterByToday(); | |||
return $query->findOne(); | |||
} | |||
} |