Skip to content

Commit

Permalink
Merge pull request #5601 from Laravel-Backpack/add-afterColumn()-alias
Browse files Browse the repository at this point in the history
add afterColumn() alias
  • Loading branch information
pxpm committed Aug 6, 2024
2 parents 89f4c31 + 2d20616 commit d0dc3f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/Library/CrudPanel/CrudColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ public function after($destinationColumn)
return $this;
}

/** Alias of after() */
public function afterColumn(string $destinationColumn)
{
$this->after($destinationColumn);
}

/**
* Move the current column before another column.
*
Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/CrudPanel/CrudPanelColumnsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,10 @@ public function testItCanPlaceColumnsFluently()
$this->crudPanel->column('test4')->before('test1');
$crudColumnsNames = array_column($this->crudPanel->columns(), 'name');
$this->assertEquals($crudColumnsNames, ['test4', 'test1', 'test3', 'test2']);

$this->crudPanel->column('test5')->afterColumn('test1');
$crudColumnsNames = array_column($this->crudPanel->columns(), 'name');
$this->assertEquals($crudColumnsNames, ['test4', 'test1', 'test5', 'test3', 'test2']);
}

public function testItCanRemoveColumnAttributesFluently()
Expand Down

0 comments on commit d0dc3f0

Please sign in to comment.