I am trying to present my form input as json format. After decoding the json data into an array, I cannot access the array.
{
"info": {
"q_title": "hello",
"q_description": "ddd",
"q_visibility": "1",
"start_date": "Thu, 05 Oct 2017 06:11:00 GMT"
}
}
This is my json data. Laravel Controller:
public function store_quiz(Request $request)
{
$data = json_decode($request->getContent(), true);
$input = $arrayName = array(
'title' => $data["info"]["q_title"],
);
CreateQuiz::create($input);
$redirect = '/';
return $redirect;
}
Unfortunately, $data["info"]["q_title"]
returns NULL. How to access the "q_tittle" of my json ??
source
share