Skip to content

Add direction argument to table defaultGroup() - #20267

Open
tanthammar wants to merge 1 commit into
filamentphp:4.xfrom
tanthammar:feature/default-group-direction
Open

Add direction argument to table defaultGroup()#20267
tanthammar wants to merge 1 commit into
filamentphp:4.xfrom
tanthammar:feature/default-group-direction

Conversation

@tanthammar

@tanthammar tanthammar commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Description

When a table has ->defaultGroup('foo'), the initial grouping direction is hardcoded to asc.

// current
$this->tableGrouping = "{$this->getTable()->getDefaultGroup()->getId()}:asc";

This PR adds a $direction argument to defaultGroup(), mirroring the existing defaultSort() signature and naming convention.

// suggested change
$table->defaultGroup('created_at', 'desc');

Functional changes

  • Did composer cs.
  • Changes have been tested (3 new tests).
  • Docs updated (packages/tables/docs/07-grouping.md).

@tanthammar
tanthammar force-pushed the feature/default-group-direction branch 2 times, most recently from c1bf3af to 9a9c974 Compare July 24, 2026 11:21
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@tanthammar
tanthammar force-pushed the feature/default-group-direction branch from 9a9c974 to 593cd3b Compare July 24, 2026 11:25
@danharrin danharrin added enhancement New feature or request pending review labels Jul 27, 2026
@danharrin danharrin added this to the v4 milestone Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants