Laravel-Backpack / CRUD

Build custom admin panels. Fast!
https://backpackforlaravel.com
MIT License
3k stars 880 forks source link

Check if uploader column is translatable in translation enabled models #5467

Closed ablunier closed 3 months ago

ablunier commented 4 months ago

WHY

Because there was a bug, reported in #5466

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

On create it works as expected but on update I get a "Integrity constraint violation column cannot be null" on the uploader not translated column even when the validation and content are ok.

AFTER - What is happening after this PR?

The reported bug is fixed.

HOW

How did you achieve that, in technical terms?

Adding a check in the Uploader::getOriginalValue method. It checks, on top of the validation that the model is translatable and the translation is enabled that the uploader field is a translatable attribute.

Is it a breaking change?

No.

How can we test the before & after?

Enabling/disabling the if check that I added in the Uploader::getOriginalValue and updating a translatable model with a non translated uploader attribute.

pxpm commented 3 months ago

Thanks @ablunier much appreciated 🙏