Imploding Collections

Posted 5 months ago by xtremer360

I'm looking for a way that I can take a collection that contains groups of inner collections and imploding by the group but with the special characters on each group and then as well with the inner groups with a different text string.

If I take my grouped collection and run toArray() on it.

array:2 [
  0 => array:2 [
    0 => array:2 [
      "id" => 1
      "name" => "Player 1"
      ]
    ]
    1 => array:2 [
      "id" => 3
      "name" => "Player 2"
      ]
    ]
  ]
  1 => array:1 [
    0 => array:2 [
      "id" => 2
      "name" => "Player 3"
      ]
    ]
  ]
]

Final result:

Player 1 & Player 2 vs. Player 3

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.