Skip to content

Commit

Permalink
exludeGlobalScopes renamed to excludeGlobalScopes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gent-fella-health committed Nov 3, 2020
1 parent 7b952da commit b7a9cf0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ If we have a scope named "***delivered***" this call will include the scope.

**Without global scopes**

`{base_url}/books?exludeGlobalScopes[]=not_delivered`
`{base_url}/books?excludeGlobalScopes[]=not_delivered`

If we have a global scope named "**not_delivered**" this call with remove the global scope.

Expand Down
14 changes: 7 additions & 7 deletions src/Controllers/LaravelController.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,17 @@ protected function parseWithCount(array $withCounts)
}

/**
* Parse exludeGlobalScopes into resource.
* Parse excludeGlobalScopes into resource.
*
* @param array $exludeGlobalScopes
* @param array $excludeGlobalScopes
*
* @return array
*/
protected function parseExludeGlobalScopes(array $exludeGlobalScopes)
protected function parseexcludeGlobalScopes(array $excludeGlobalScopes)
{
$return = [];

foreach ($exludeGlobalScopes as $exludeGlobalScope) {
foreach ($excludeGlobalScopes as $exludeGlobalScope) {
$return[] = $exludeGlobalScope;
}

Expand Down Expand Up @@ -254,7 +254,7 @@ protected function parseResourceOptions($request = null)
'withs' => [],
'has' => [],
'doesntHave' => [],
'exludeGlobalScopes' => [],
'excludeGlobalScopes' => [],
'scope' => [],
'sort' => [],
'limit' => null,
Expand All @@ -273,7 +273,7 @@ protected function parseResourceOptions($request = null)
$withs = $request->get('with', $this->defaults['withs']);
$has = $request->get('has', $this->defaults['has']);
$doesntHave = $request->get('doesntHave', $this->defaults['doesntHave']);
$exludeGlobalScopes = $this->parseExludeGlobalScopes($request->get('exludeGlobalScopes', $this->defaults['exludeGlobalScopes']));
$excludeGlobalScopes = $this->parseexcludeGlobalScopes($request->get('excludeGlobalScopes', $this->defaults['excludeGlobalScopes']));
$scope = $request->get('scope', $this->defaults['scope']);
$sort = $this->parseSort($request->get('sort', $this->defaults['sort']));
$limit = $request->get('limit', $this->defaults['limit']);
Expand All @@ -290,7 +290,7 @@ protected function parseResourceOptions($request = null)
'withs' => $withs,
'has' => $has,
'doesntHave' => $doesntHave,
'exludeGlobalScopes' => $exludeGlobalScopes,
'excludeGlobalScopes' => $excludeGlobalScopes,
'modes' => $modes,
'scope' => $scope,
'sort' => $sort,
Expand Down
12 changes: 6 additions & 6 deletions src/Database/EloquentBuilderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ protected function applyResourceOptions(Builder $queryBuilder, array $options =
}
}

if (isset($exludeGlobalScopes)) {
if (!is_array($exludeGlobalScopes)) {
throw new InvalidArgumentException('exludeGlobalScopes should be an array.');
if (isset($excludeGlobalScopes)) {
if (!is_array($excludeGlobalScopes)) {
throw new InvalidArgumentException('excludeGlobalScopes should be an array.');
}

$this->applyWithouGlobalScopes($queryBuilder, $exludeGlobalScopes);
$this->applyWithouGlobalScopes($queryBuilder, $excludeGlobalScopes);
}

if (isset($filter_groups)) {
Expand Down Expand Up @@ -127,9 +127,9 @@ protected function applyFilterGroups(Builder $queryBuilder, array $filterGroups
}
}

protected function applyWithouGlobalScopes(Builder $queryBuilder, array $exludeGlobalScopes = [])
protected function applyWithouGlobalScopes(Builder $queryBuilder, array $excludeGlobalScopes = [])
{
$queryBuilder->withoutGlobalScopes($exludeGlobalScopes);
$queryBuilder->withoutGlobalScopes($excludeGlobalScopes);
}

protected function applyFilter(Builder $queryBuilder, array $filter, $or = false)
Expand Down

0 comments on commit b7a9cf0

Please sign in to comment.