Well, first of all when you create the item it will store one array with the values. In the update you push a new array to it. However that will result in the following structure
[
"test" => "test",
"random" => "random",
0 => [
"test" => "test",
"random" => "random",
],
]
If you only want to store arrays you need to do something like this
if (! $eval->responses) {
$array = array(
array(
'questionId' => $request->questionId ,
'responseId' => $request->responseId
)
);
} else {
$response = array(
'questionId' => $request->questionId ,
'responseId' => $request->responseId
);
$array = array_push($array, $response);
}
The second problem with your code is the return value of array_push. It returns the number of items in the array instead of the array. So you're not serializing the array anymore but you're serializing an integer.
You can simply fix it by just calling array_push and not assigning it to a value
array_push($array, $response);
$eval->responses = serialize($array);
Let me know if this make sense ;)