Press "Enter" to skip to content

Wrapping non array item in array

Sharing is caring!

We all use collections in laravel. It’s how we have been dealing with data.

At some points we want our item inside collection to be wrapped inside an array, if it is not an array.

For example

But it can be more simpler.

Wait, it can be more simpler.

And, it is just plain simple.

Everything is awesome.

2 Comments

    Leave a Reply

    Your email address will not be published.