Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
Merge pull request #118 from apility/develop
Browse files Browse the repository at this point in the history
Fix condition for checking structure id
  • Loading branch information
thomas-alrek authored Dec 13, 2019
2 parents e514edf + 518aede commit 6c4adb8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/model/Structure.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,20 @@ public function getPublishedAttribute ($published) {

if ($published && $this->use_time) {
$start = null;

try {
$start = Carbon::parse($this->start);
} catch (Exception $ex) {
$start = Carbon::parse(0);
}

try {
$stop = $this->stop ? $this->stop : PHP_INT_MAX;
$stop = Carbon::parse($stop);
} catch (Exception $ex) {
$stop = Carbon::parse(PHP_INT_MAX);
}

$now = Carbon::now();

return $now->gte($start) && $now->lte($stop);
Expand Down Expand Up @@ -348,16 +348,16 @@ public static function find($id)
$response = NF::$capi->get($url);
$data = json_decode($response->getBody(), true);

if (!$data || $data['directory_id'] != $structureId) {
$data = null;
}

if ($data && !isset($entry_override)) {
NF::$cache->save($cacheKey, $data);
}
}

if ($data) {
if (!$data || ($data['directory_id'] != $structureId)) {
return null;
}

return static::generateObject($data);
}
} catch (Exception $ex) { /* intentionally left blank */ }
Expand Down

0 comments on commit 6c4adb8

Please sign in to comment.