Errorexception: unserialize(): Error at offset 0 of 9947 bytes in file in Laravel

Asked

Viewed 56 times

1

I’m having this error in the Standard when trying to fetch data from my database:

Errorexception: unserialize(): Error at offset 0 of 9947 bytes in file

Controller:

    public function show(Request $request)
{
    $animaisAdocao = animalAdocao::where('id_usuario', $request->id)->get();

    for($i = 0; $i < count($animaisAdocao); $i++){
        $animaisAdocao[$i]['sociabilidade'] = unserialize($animaisAdocao[$i]['sociabilidade']);
        $animaisAdocao[$i]['temperamento'] = unserialize($animaisAdocao[$i]['temperamento']);
        $animaisAdocao[$i]['complementos'] = unserialize($animaisAdocao[$i])['complementos'];

    }


    return response()->json($animaisAdocao);
}

My route:

Route::get('animalAdocao/{id}', 'AnunciaAdocaoController@show');

My data in the comic book:

inserir a descrição da imagem aqui

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.