How to use the forget () method in the Laravel collection
This article mainly introduces how to use the forget () method in the Laravel collection, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Forget ()
Forget simply removes the item from the collection. You only need to pass a key and it removes the item from the collection.
$forget = collect (['country' = >' usa', 'state' = >' ny']); $forget- > forget ('country')-> all ()
The response from the above code is as follows:
["state" = > "ny"]
Forget does not apply to multidimensional arrays.
Thank you for reading this article carefully. I hope the article "how to use the forget () method in the Laravel collection" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!