KarolGil
3 months ago

Laravel serialize response

Posted 3 months ago by KarolGil

Hi,

I have a code:

// Controller:  

$newData = $this->getOffersList($data, $request);

//  dd( mb_detect_encoding ( $newData[0]['description'] )); // "ASCII"

return response()->json([
    'error'=>false,
    'offers'=> $newData
]);

How can I exchange it for:

$newData = serialize($newData);

And send the data in response along with error = false?

Please sign in or create an account to participate in this conversation.