Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kankai's avatar

Show select array value in view

Hi all,

I'm new with eloquent realationship, what i'm doing is having 3 database tables and i success get all data. I'm joining database table 'work' with 'wallet' and 'appsData', but i'm facing problem that how to show these data in view.

[{"game_id":"1001","check_wallet":[{"id":355,"wallet":"20314","game_id":"1001","status":0,"warning":0,"create_user":"WENDY","edit_user":null,"delete_user":null,"created_at":"2018-06-01 08:53:07","edited_at":"2018-06-01 08:53:07","check_detail":[{"id":1228,"wallet_id":"20314","apps_type":"whatsapp","prev_apps_id":null,"apps_id":"abc","type":null,"remarks":null,"status":0,"created_at":"2018-06-01 08:53:07","created_user":"WENDY"}]}]}

I need to show "apps_type", i have try echo it with {{ $data->check_detail->apps_type }} But it comes out error, what is the correct syntax to select this value in array? Thanks

0 likes
2 replies
andreich1980's avatar
Level 50
  1. What error?

check_detail looks like an array/Collection, so you would use first on it.

{{ $data->check_detail->first()->apps_type }}
kankai's avatar

@ANDREICH1980 - The error message is 'Undefined index', but now i tried your code and problem has been solved. Thank you very much!

1 like

Please or to participate in this conversation.