Skip to content

Commit

Permalink
load request
Browse files Browse the repository at this point in the history
  • Loading branch information
ewilan-riviere committed Aug 15, 2023
1 parent 744171a commit d66a399
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Queries/BaseQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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
Expand All @@ -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";
Expand Down Expand Up @@ -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
Expand All @@ -164,6 +170,8 @@ public function response(): LengthAwarePaginator|Collection
*/
public function collection(): AnonymousResourceCollection
{
$this->loadRequest();

if (! class_exists($this->resource)) {
$this->resource = DefaultResource::class;
}
Expand Down

0 comments on commit d66a399

Please sign in to comment.