CRUD icon indicating copy to clipboard operation
CRUD copied to clipboard

Fix column key definition

Open pxpm opened this issue 3 years ago • 2 comments

WHY

BEFORE - What was wrong? What was happening before this PR?

I already attempted it here: https://github.com/Laravel-Backpack/CRUD/pull/4504

It was not fully functional, this fixes it for good I hope.

AFTER - What is happening after this PR?

You can add columns with the same name and define them fluently.

HOW

How did you achieve that, in technical terms?

Can't use core crud functions because they rely on the column key already set, the only way to make it work with core crud function like modifyColumn etc was if we changed CrudColumn constructor to accept the key.

I manually add the column to the operation settings.

Is it a breaking change?

I don't think so.

How can we test the before & after?

In PetsCrudController, add:

CRUD::column('owners')->key('owners')->label('owner'); CRUD::column('owners')->key('owners_2')->label('owner 2'); CRUD::column('owners')->key('owners_3')->label('owner 3');

should yield: image

pxpm avatar Jul 25 '22 16:07 pxpm

Hi there @pxpm

I check on this, main branch, just show "owners" and "owners_3".

screenshot-backpack test-2022 08 04-21_45_29

In "fix-column-key-definition" branch, show everything as as expected

screenshot-backpack test-2022 08 04-21_54_13

I tried to play with orderable and works too.

For me look great, nothing to add this time.

Thanks for PR.

Cheers.

jcastroa87 avatar Aug 05 '22 02:08 jcastroa87

Hi @pxpm i can confirm now is working as expected. Hello @tabacitu, in my review look ready to merge.

screenshot-backpack test-2022 08 09-08_32_32

Cheers.

jcastroa87 avatar Aug 09 '22 12:08 jcastroa87