Reputation: 5
I have an array of array object data but I am getting an error when I try to print this in view. Here is my data:
Array ( [0] => stdClass Object ( [id] => 2 [user_id] => 4 [user_name] => Infinity Resort [listing_name] => 200 Hour Yoga Teacher Training [course] => 200 Hour Yoga Teacher Training [course_duration] => [retreat_type] => Featured [start_date] => [end_date] => [last_day_to_register] => [contact_person] => Infinity Resort [website] => http://bookyogatrips.com [contact_number] => 265478541 [address1] => Kathmandu ,Bagmati Nepal 4460 [address2] => [country] => Thailand [country_id] => 217 [state] => Bangkok [state_id] => 3528 [city] => Bangkok [pincode] => 44600 [rooms_type] => [overview] =>
hjkhjkhj
[program_description] =>
kjhkjhkhj
[curriculum] =>
hjkjhk
[why_choose] => [area_destination] =>
hkjhkhjk
[location] => [about_food] =>
hjkjhkjhk
[program_special] => [inclusions] => [food] => Vegetarian,Vegan [accommodaion_image] => [currency] => [itineraries] => [local_info] => [weather_information] => [seasonal_information] => [meta_title] => [meta_description] =>
hkjhkjhkh
[meta_keyword] =>
ghjghj
[service_type] => Yoga TTC [course_cat] => 2 [media] => 101839ManasluTrek.jpg [approved] => 1 [created_at] => 2018-11-14 10:41:50 [updated_at] => 2018-11-14 10:41:50 [_token] => ) )
How can I print this data in a Laravel view?
Upvotes: 0
Views: 88
Reputation: 3182
If it's array of objects then you can give a try like below code:
foreach($arrayObjects as $object){
...
$object->id;
$object->user_id;
...
}
Upvotes: 0
Reputation: 329
Please try below code
foreach ($objdata as $data) {
$data = (array) $data
// now $data is array
}
Upvotes: 1