5 Must Know Methods to Modify Collections - Mastering Eloquent & Collection Methods
HTML-код
- Опубликовано: 30 июл 2024
- In this tutorial, we’re going to cover various methods for modifying collections in Laravel. The first method is the push() method, which adds one or more elements to the end of a collection; put(), which sets a value on a collection by a given key and can update an existing value or append a new key-value pair; forget(), which removes an item from a collection by its key; pop(), which removes the last element from a collection and returns its value; and shift(), which removes the first element from a collection and returns its value.
📚 New Udemy Course
If you're looking to level up your Laravel skills? My new course "Mastering Laravel 10 Query Builder, Eloquent & Relationships" is the perfect opportunity. Learn the essential tools and techniques for building robust and scalable web applications with Laravel: www.udemy.com/course/masterin...
🧑🏼💻 Let’s plan a meeting
Do you need assistance with your next project in Laravel? Contact my Laravel agency for help! www.codewithdary.com
💌 Newsletter
Sign up for my free weekly email newsletter: newsletter.codewithdary.com/
🔥 Resources
- Twitter: / codewithdary
- Instagram: / codewithdary
- Blog: blog.codewithdary.com
- Patreon: www.patreon.com/user?u=30307830
- GitHub: github.com/codewithdary
- TikTok: / codewithdary
📋 Table of Content
00:00 - push()
01:24 - put()
03:43 - forget()
04:41 - pop()
05:51 - shift()
06:35 - Outro
#laravel #php #codewithdary