Display odds from database table like they are in bookmaker sites

Frank Thomas :

I have a table odds where

MATCH_ID | HOME_ID |Away_ID | Group_name | Line_name      | Odd |
3000     | 1       | 2      | 1x2        | Chelsea        | 1.4
3000     | 1       | 2      | 1x2        | Liverpool      | 2.8
3000     | 1       | 2      | Handicap   | Chealse - 1.5  | 2.9
3000     | 1       | 2      | Handicap   | Liverpool +1.5 | 1.4

every match has odds related to this match.

How i could get the odds listed like they are on bookmaker websites like Bet365 when you click on some event and they are grouped and related?

Expected output:

Image

Thank you!

As you can see in the picture "To Win" would be 1x2 on my table.

As well as Point Betting would be Handicap

Ramūnas Pabrėža :

You have to group your results by 'Group_name' column. e.g. ->where('MATCH_ID', 3000)->get()->groupBy('Group_name') https://laravel.com/docs/7.x/collections#method-groupby

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=193422&siteId=1