Skip to content

Commit

Permalink
Make action pagination parameters nullable and shift defaults to there
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Dec 24, 2022
1 parent 3de00f3 commit 3dba236
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ protected function addCreatedAtMetaField(): void
protected function getPaginationSettings(): array
{
if ($this->option('use-defaults') || ! $this->confirm('Do you want to configure pagination settings?')) {
return ['__createdAt', true, 25, true];
return [null, null, null, null];
}

return [$this->getSortField(), $this->getSortDirection(), $this->getPageSize(), $this->getPrevNextLinks()];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public function __construct(
protected string $name,
protected Collection $fields,
protected string $canonicalField,
protected string $sortField,
protected bool $sortAscending,
protected bool $prevNextLinks,
protected int $pageSize,
protected ?string $sortField,
protected ?bool $sortAscending,
protected ?bool $prevNextLinks,
protected ?int $pageSize,
protected ?OutputStyle $output = null,
) {
$this->dirName = $this->formatStringForStorage($this->name);
Expand All @@ -42,10 +42,10 @@ protected function handleCreate(): void
"{$this->dirName}_detail",
"{$this->dirName}_list",
[
$this->sortField,
$this->sortAscending,
$this->prevNextLinks,
$this->pageSize,
$this->sortField ?? '__createdAt',
$this->sortAscending ?? true,
$this->prevNextLinks ?? true,
$this->pageSize ?? 25,
],
$this->fields->toArray()
);
Expand Down

0 comments on commit 3dba236

Please sign in to comment.