Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ligonsker's avatar

Dynamically translating table column names based on DB - how to save it case of a change?

I currently display different tables dynamically using Schema::getColumnListing($table_name);

And using Localization to translate from the column names to the actual name I want to display in the header.

But now that I think about it - it might not be the best idea because if a column changes on the DB, the translation won't work and will appear as some random string from the localization file.

Is there a way to improve that? I recently changed a few tables in which the column names were hardcoded in the <th> so there was no issue.

Should I abandon the idea of dynamically creating the table?

0 likes
0 replies

Please or to participate in this conversation.