Skip to content

Commit

Permalink
Small scope additions
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyleeh committed Mar 29, 2016
1 parent cbd0187 commit a4cdc43
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 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.3.1",
"version": "1.3.2",
"authors": [
{
"name": "Hyleeh",
Expand Down
27 changes: 27 additions & 0 deletions src/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,33 @@ protected function orderQueryBySourceAttribute(Builder $query, $attribute, $dire
->orderBy('t.' . $attribute, $direction);
}

/**
* Gets a node by name
*
* @param Builder $query
* @param string $name
* @param string|null $locale
* @return Builder
*/
public function scopeByName(Builder $query, $name, $locale = null)
{
return $this->scopeWhereTranslation($query, 'node_name', $name, $locale);
}

/**
* Gets nodes by type
*
* @param Builder $query
* @param string $type
* @param string|null $locale
* @return Builder
*/
public function scopeWithType(Builder $query, $type, $locale = null)
{
return $this->scopeWhereTranslation($query, 'source_type', $type, $locale);
}


/**
* Published scope
*
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/HierarchyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class HierarchyServiceProvider extends ServiceProvider {

const version = '1.3.1';
const version = '1.3.2';

/**
* Indicates if loading of the provider is deferred.
Expand Down

0 comments on commit a4cdc43

Please sign in to comment.