Can you show us the routes
Cant store Api data into db.
I trying to store some Api data into db but receive error.
ErrorException Undefined index: name
$offers = Http::get('https://api.lootably.com/api/v1/offers/get?&apiKey=d7culg61xyw1i6ucg99edipd8iyxjuect20dx662d9&placementID=cki5rbmik000j01z29404h5je&rawPublisherUserID='.$session_id)->json();
$offers = $offers['data'];
//dd($offers);
Offers::create([
'name' => $offers['name'],
'description' => $offers['description'],
'payout' => $offers['revenue'],
'amount' => $offers['currencyReward'],
'link' => $offers['link'],
'image' => $offers['image'],
'countries' => 'Ro',
'devices' => 'Android',
'count' => 1,
]);
@emilpapelas4@gmail.com like I said...
you can json_encode the array providing your column can handle the length
Your column cannot handle data that length! You will need to either (i) alter your table to make countries column a TEXT or LONGTEXT type; (ii) truncate the data before inserting (which throws away information you might need) or (iii) extract a separate pivot table for offer_country and store the data that way instead
Please or to participate in this conversation.