diff --git a/src/Queries/BaseQuery.php b/src/Queries/BaseQuery.php index a8e7ab7..fe89a34 100644 --- a/src/Queries/BaseQuery.php +++ b/src/Queries/BaseQuery.php @@ -100,6 +100,7 @@ protected function setup(string|Builder $model, Request $request = null): self $this->resourceGuess(); $this->query = QueryBuilder::for($this->builder); + $this->loadRequest(); return $this; } @@ -109,6 +110,8 @@ protected function setup(string|Builder $model, Request $request = null): self */ public function get(): QueryResponse { + $this->loadRequest(); + return QueryResponse::make( original: $this->response()->toArray(), defaultSort: $this->defaultSort @@ -125,6 +128,7 @@ public function closure(\Closure $closure): mixed public function export(): ?BinaryFileResponse { + $this->loadRequest(); $this->exportGuess(); // $name = trans_choice("crud.{$this->resource}.name"; @@ -152,6 +156,8 @@ public function export(): ?BinaryFileResponse */ public function response(): LengthAwarePaginator|Collection { + $this->loadRequest(); + $full = $this->request->boolean('full') || $this->request->boolean('no-paginate'); return $full || $this->noPaginate @@ -164,6 +170,8 @@ public function response(): LengthAwarePaginator|Collection */ public function collection(): AnonymousResourceCollection { + $this->loadRequest(); + if (! class_exists($this->resource)) { $this->resource = DefaultResource::class; }