I have a database model with json
column type called attributes
. This column will contain additional details of the model.
For example:
attributes : {'desc' : 'test', 'width' : '500'}
.
I would like to display individual attribute (desc
& width
) in attributes
column as a html field in Laravel admin resource.
I checked supported field types and doesn't seem supports.
Any suggestions how I can do this?
I'm not sure if it's the recommended answer but i've found a way that should work for you.
Use an Eloquent Mutator: Eloquent Mutators
Then you define a getDescAttribute
and a setDescAttribute
and pass it in nova like a property on the model like so:
Text::make('Desc', 'desc')
Hope this helps.