I have an external api that send a POST to my server the POST body comes in a json response as an array
{
"IDs": [
1378143,1378141,1971403,1451025,1451026,1374561,1378036,1371423,1371424,
1971568,1371426,1718539,1718515,1831163,1718540,1362068,1376341,1378221,
1378222,1378220,1380468,1380467,1417322,1385612,1971567
]
}
I save the post as following:
$Id = new IdModel();
$Id->id = $request['IDs'];
$Id->save();
This save the array in my database column id as "Array" how can I get all the values in the array to save instead of the word Array?
foreach($request['IDs'] as $id) {}to process each ID separately. It's unclear from your question if each ID should get a separateIdModelrecord or if something else is going on.IdModelrecord I know how I can pass those into each record. I am just trying to understand why the array displays as "Array" in the column of the db.