Skip to content

Commit ed8d9ab

Browse files
authored
fix(shops): only check date if shop is timed in active check (lk-arpg#1408)
* fix(shops): shop being displayed as inactive when is_timed_shop is false but date data still exists * refactor: fix PHP styling --------- Co-authored-by: perappu <perappu@users.noreply.github.com>
1 parent cff830e commit ed8d9ab

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

app/Models/Shop/Shop.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -200,20 +200,22 @@ public function getMonthsAttribute() {
200200
* We dont account for is_visible here, as this is used for checking both visible and invisible shop.
201201
*/
202202
public function getIsActiveCheckAttribute() {
203-
if ($this->start_at && $this->start_at > Carbon::now()) {
204-
return false;
205-
}
206-
207-
if ($this->end_at && $this->end_at < Carbon::now()) {
208-
return false;
209-
}
210-
211-
if ($this->days && !in_array(Carbon::now()->format('l'), $this->days)) {
212-
return false;
213-
}
214-
215-
if ($this->months && !in_array(Carbon::now()->format('F'), $this->months)) {
216-
return false;
203+
if ($this->is_timed_shop) {
204+
if ($this->start_at && $this->start_at > Carbon::now()) {
205+
return false;
206+
}
207+
208+
if ($this->end_at && $this->end_at < Carbon::now()) {
209+
return false;
210+
}
211+
212+
if ($this->days && !in_array(Carbon::now()->format('l'), $this->days)) {
213+
return false;
214+
}
215+
216+
if ($this->months && !in_array(Carbon::now()->format('F'), $this->months)) {
217+
return false;
218+
}
217219
}
218220

219221
if (!$this->is_timed_shop && !$this->is_active) {

0 commit comments

Comments
 (0)