I am wanting to explode my decoded JSON so I can remove the spacing and call certain values in a table. I am confident I need to use explode to achieve what I am after it's my first time using it so I am unsure exactly how to work it
My controller is:
public function index($id)
{
$message = Message::find($id);
$content = json_decode($message->content,TRUE);
var_dump($content);
explode(',',',{,},[,]');
return view('details', ['message' => $message]);
}
I have a standard table of
<td>{{$message->type}}</td>
<td>{{$message->content}}</td>
<td>{{$message->response}}</td>
<td>{{$message->id}}</td>
I have a vardump currently on the controller so I can see what is being parsed through (and to test that my decode was working). It is returning the following:
array(2) { ["text"]=> string(4) "test" ["suggestions"]=> array(1) { [0]=> array(1) { ["reply"]=> array(2) { ["text"]=> string(4) "test" ["postbackData"]=> string(36) "e05ad1f0-a0f8-4a56-a8c7-67f56ba9fe4c" } } } }
I am wanting to explode this so I can extract each of them into different columns in my table