What is the query? And can you show the model?
Oct 12, 2022
12
Level 2
Json decode and encode
i'm storing data as json object in database like this
'custom_field'=>json_encode(['teacher_description'=>$request->custom_field])
i want to show this data but when i do this in blade it gives this error blade
{{json_decode($teacher->custom_field)}}
error
htmlspecialchars(): Argument #1 ($string) must be of type string, stdClass given
for example i want if i stored hello in the teacher_description i write this in blade to get hello message any hint ?
{{json_decode($teacher->custom_field->teacher_description)}}
Level 102
@karimali1337 Try this. First decode, then get teacher_description
{{json_decode($teacher->custom_field)->teacher_description}}
1 like
Please or to participate in this conversation.