rendering human readable versions of database values #2449
calvinmkissinger
started this conversation in
General
Replies: 1 comment
-
To be fair and answer this for others, it's in the docs: In order to render your own template or additional processing, you can use the closure function passed to the render method: Layout::legend('user', [ If such processing is needed often, then a more appropriate solution would be to create a Blade component (More details) and specify it: Layout::legend('user', [ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am using Orchid to build a admin GUI on top an existing tool I have at my job. I am mostly new to laravel so this may be something better addressed in the Model or a Helper, if so, just point me in the right place! thank you.
In many places the database has sort of 'enums' stored in shorthand.
For example: field LogEnabled has the values either "Y" or "N".
The same for "Active", it has "1" or "0",
Other places I have things like a "log level" of 1-5, which represent: OFF, INFO, WARN, ERROR, FATAL
Another place, we have several options like "P", "C", and "F" for "pending" "complete" and "failed".
Now - I understand ultimately this is not very 'good' database design, but I'm here to build a UI, not refactor the entire tool :-)
Given that I want to represent to the admin user a human readable version of the strings.
Right now I have something like this in my ConnectionListLayout.php:
Which totally works, however... I am finding many places I'll have to do this in and it's going to be a night mare to maintain.
Is there a better way to do this in one place in Orchid/Laravel so that I don't need to copy and paste this everywhere.
Thank you again!
Beta Was this translation helpful? Give feedback.
All reactions