You want it back to the model object?
$model = new Model($f[0]);
I had an array with many objects inside but I removed them all but one and now I have an array with a singular object inside. I need it to be a object and not an array because it was originally an object and in order to do some sorting and filtering I changed it to an array but now I need it to be an object again.
I tried this without success
$f = json_decode(json_encode($f));
A dd on $f returns this, as you can see it's one object in an array I would like it to be just the object not inside an array.
[
{
"id":1,
"question":"adasdf",
"instruction":null,
"user_id":1,
"survey_section_id":1,
"response_type_id":3,
"optional":0,
"num":null,
"rank":4,
"show_text":0,
"image":null,
"video":null,
"created_at":"2020-06-19 08:54:27",
"updated_at":"2020-06-19 08:54:27",
"pivot":{},
"answer":[],
"answer_pager":[]
}
]
How can I fix this?
Please or to participate in this conversation.