diff --git a/docs/_sidebar.md b/docs/_sidebar.md index de071a2..f626821 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -11,7 +11,6 @@ - Scopes - [Quick start](scopes.md?id=scopes) - [Usage](scopes.md?id=usage) - - [Remove Global Scopes](scopes.md?id=remove-global-scopes) - Appends - [Quick start](appends.md?id=appends) diff --git a/docs/scopes.md b/docs/scopes.md index e926163..602d351 100644 --- a/docs/scopes.md +++ b/docs/scopes.md @@ -8,15 +8,4 @@ The following query parameter will add the `popular` scope: ```url {base_url}/users?scope[]=popular -``` - -# Remove Global Scopes - -Global scopes allow you to add constraints to all queries for a given model. -What if we want to remove it ? - -The following query parameter will remove the `delivered` global scope: - -```url -{base_url}/books?excludeGlobalScopes[]=delivered ``` \ No newline at end of file diff --git a/src/Controllers/LaravelController.php b/src/Controllers/LaravelController.php index e98dab9..9e00c94 100644 --- a/src/Controllers/LaravelController.php +++ b/src/Controllers/LaravelController.php @@ -216,24 +216,6 @@ protected function parseWithCount(array $withCounts) return $return; } - /** - * Parse excludeGlobalScopes into resource. - * - * @param array $excludeGlobalScopes - * - * @return array - */ - protected function parseExcludeGlobalScopes(array $excludeGlobalScopes) - { - $return = []; - - foreach ($excludeGlobalScopes as $exludeGlobalScope) { - $return[] = $exludeGlobalScope; - } - - return $return; - } - /** * Parse filters. * @@ -367,7 +349,6 @@ protected function parseResourceOptions($request = null) 'withs' => [], 'has' => [], 'doesntHave' => [], - 'excludeGlobalScopes' => [], 'scope' => [], 'sort' => [], 'limit' => null, @@ -392,7 +373,6 @@ 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']); - $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']); @@ -415,7 +395,6 @@ protected function parseResourceOptions($request = null) 'withs' => $withs, 'has' => $has, 'doesntHave' => $doesntHave, - 'excludeGlobalScopes' => $excludeGlobalScopes, 'modes' => $modes, 'scope' => $scope, 'sort' => $sort, diff --git a/src/Database/EloquentBuilderTrait.php b/src/Database/EloquentBuilderTrait.php index 3700aea..2cb94c0 100644 --- a/src/Database/EloquentBuilderTrait.php +++ b/src/Database/EloquentBuilderTrait.php @@ -69,10 +69,6 @@ protected function applyResourceOptions(Builder $queryBuilder, array $options = } } - if (isset($excludeGlobalScopes)) { - $this->applyWithouGlobalScopes($queryBuilder, $excludeGlobalScopes); - } - if (isset($filter_groups)) { $this->applyFilterGroups($queryBuilder, $filter_groups); } @@ -158,11 +154,6 @@ protected function applySortByDesc(Builder $queryBuilder, array $sortByDesc = [] } } - protected function applyWithouGlobalScopes(Builder $queryBuilder, array $excludeGlobalScopes = []) - { - $queryBuilder->withoutGlobalScopes($excludeGlobalScopes); - } - protected function applyFilter(Builder $queryBuilder, array $filter, $or = false) { $column = $filter['column'];