lundi 7 octobre 2019

Laravel: Keeping getting empty object when trying to set data

log_info($user_data);

///// 
[{"subattachments":[{"media":{"image": 
   {"height":300,"src":"https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-9\/xxxx? 
  _nc_cat=100&_nc_oc=AQnPbAwUeVrY1djM0Pf87c2&oe=5E333339","width":306}},.....
 ]
/////

--

    $extras = [
        'message'      => "testing",
        'url'          => product_image($image_url),
        'attachments'  => $user_data,
    ];

    $post->info = json_encode($extras);

At the top, I logged $user_data and below that the shape of the data that it logs.

After setting this data when I go to log $post->info, the message field and url fields are showing properly when I log them, but the attachments field keeps showing up as {}.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire