diff --git a/src/Macros/ResponseTransformer/GetRequestedIncludes.php b/src/Macros/ResponseTransformer/GetRequestedIncludes.php index 609e814d6..3b91005b6 100644 --- a/src/Macros/ResponseTransformer/GetRequestedIncludes.php +++ b/src/Macros/ResponseTransformer/GetRequestedIncludes.php @@ -11,7 +11,7 @@ class GetRequestedIncludes public function __invoke(): callable { return function (): array { - return app(Manager::class)->parseIncludes(Request::get(Config::get('apiato.requests.params.include'), []))->getRequestedIncludes(); + return app(Manager::class)->parseIncludes(Request::get(Config::get('apiato.requests.params.include', 'include'), []))->getRequestedIncludes(); }; } } diff --git a/src/Traits/CanEagerLoadTrait.php b/src/Traits/CanEagerLoadTrait.php index 87009f02d..80c0f7fc7 100644 --- a/src/Traits/CanEagerLoadTrait.php +++ b/src/Traits/CanEagerLoadTrait.php @@ -18,7 +18,7 @@ trait CanEagerLoadTrait { protected function eagerLoadRequestedRelations(): void { $this->scopeQuery(function (Builder|Model $model) { - if (Request::has(config('apiato.requests.params.include'))) { + if (Request::has(config('apiato.requests.params.include', 'include'))) { $validIncludes = []; foreach (ResponseTransformer::getRequestedIncludes() as $includeName) { $relationParts = explode('.', $includeName); diff --git a/tests/Unit/Abstracts/Repositories/RepositoryTest.php b/tests/Unit/Abstracts/Repositories/RepositoryTest.php index 6d6761861..e8dda2e78 100644 --- a/tests/Unit/Abstracts/Repositories/RepositoryTest.php +++ b/tests/Unit/Abstracts/Repositories/RepositoryTest.php @@ -36,7 +36,7 @@ public static function includeDataProvider(): array #[DataProvider('includeDataProvider')] public function testEagerLoadSingleRelationRequestedViaRequest(string $includes, array $mustLoadRelations, array $mustNotLoadRelations): void { - request()->offsetSet(config('apiato.requests.params.include'), $includes); + request()->offsetSet(config('apiato.requests.params.include', 'include'), $includes); $parent = UserFactory::new()->has( UserFactory::new()->count(3), 'children'