@stretch0 That's not strictly a Lumen thing. When you return the results of Eloquent queries, they are automatically converted JSON in Laravel as well.
As for returning an array, have you tried this?
return $ad_campaigns->toArray();
Summer Sale! All accounts are 50% off this week.
Hi
I am struggling to understand how to handle data requests with Lumen. I have used Laravel a bit so just getting caught up on a couple of small differences.
When I call
ad_campaigns = FbAdCampaign::all();
echo "<pre>";
print_r($ad_campaigns);
echo "</pre>";
die;
I get weird output that has a lot of useless info (I assume you have seen this before) I notice that if I use
return ad_campaigns;
then I get json returned and understand that is a lumen thing but what if I want an array returned from ad_campaigns = FbAdCampaign::all();
I want an array so I can use array_diff() function and manipulate the data.
@stretch0 That's not strictly a Lumen thing. When you return the results of Eloquent queries, they are automatically converted JSON in Laravel as well.
As for returning an array, have you tried this?
return $ad_campaigns->toArray();
Please or to participate in this conversation.