HopesAreMiracle
1 year ago
75
15
General

How do I combine three foreach loops into one ?

Posted 1 year ago by HopesAreMiracle

Hello all , I have a problems with my report. In my database , i have columns and data like this

id = 1 , code = ' 123 ' , amount = ' 100 ' , type = ' - '

id = 2 , code = ' 123 ' , amount = ' 200 ' , type = ' + '

id = 3 , code = ' 456 ' , amount = ' 400 ' , type = ' - '

id = 4 , code = ' 456 ' , amount = ' 500 ' , type = ' + '

retrieve from the database is ok . i have 2 objects to store. but what i having problems right now is looping , i want to show in my blade.php as a 1 record for same code like this.

i want my report format like this

Code = ' 123 ' From Amount = ' 100 ' To Amount = ' 200 ' Code = ' 456 ' From Amount = ' 400 ' To Amount = ' 500 '

i tried many ways. but actual outcome don't come out with my expected one. Thanks . I really need help.

Thanks all.

Please sign in or create an account to participate in this conversation.