Display Table form with Eloquent Data Laravel -


i have object structure store in eloquent form

{"item_id": "2", "item_color": "black", "item_size": "l", "item_quantity": "5",},  {"item_id": "2", "item_color": "black", "item_size": "m", "item_quantity": "5",},  {"item_id": "2", "item_color": "black", "item_size": "s", "item_quantity": "5",},  {"item_id": "2", "item_color": "white", "item_size": "s", "item_quantity": "5",}, 

what i'm trying achieve combine item_quantity has same item_id , item_color , display in table form this.

itemid itemcolor itemsize  quantity   total 2         black    l-m-s    5-5-5      15 2         white     s       5          5 

in research nearest kind of solution im having trouble on displaying in table form

http://stackoverflow.com/questions/23902541/add-array-values-of-same-array-keys-in-session 

$items = db::table('item')             ->select(db::raw("item_id,item_color,group_concat(item_size separator '-') itemsize,group_concat(item_quantity separator '-') quantity,sum(item_quantity) total"))             ->groupby('item_id','item_color')             ->get(); 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -