Skip to content

Commit

Permalink
Fixed published scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Egemen Berker Kızılcan committed Dec 29, 2015
1 parent 367066e commit 52c65f9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"laravel",
"laravel5"
],
"version": "1.1.15",
"version": "1.1.16",
"authors": [
{
"name": "Hyleeh",
Expand Down
20 changes: 11 additions & 9 deletions src/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,15 @@ public function getNewTranslation($locale)
*/
public function scopePublished($query)
{
return $query
->where('status', '>=', Node::PUBLISHED)
->orWhere(function ($query)
{
$query->where('status', '>=', Node::PENDING)
->where('published_at', '<=', Carbon::now());
});
return $query->where(function ($query)
{
$query->where('status', '>=', Node::PUBLISHED)
->orWhere(function ($query)
{
$query->where('status', '>=', Node::PENDING)
->where('published_at', '<=', Carbon::now());
});
});
}

/**
Expand Down Expand Up @@ -355,9 +357,9 @@ public function hasTranslatedChildren($locale)
*/
public function getLocaleForNodeName($name)
{
foreach($this->translations as $translation)
foreach ($this->translations as $translation)
{
if($translation->node_name === $name)
if ($translation->node_name === $name)
{
return $translation->locale;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/HierarchyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class HierarchyServiceProvider extends ServiceProvider {

const version = '1.1.15';
const version = '1.1.16';

/**
* Register the service provider.
Expand Down

0 comments on commit 52c65f9

Please sign in to comment.