Laravel Pro Tips
#Laravel Tip 🔥 : You can set the prefix in array keys with newly released method prependKeysWith() in Laravel 9.14.0
Let's checkout an example 👇:
#PHP #webdevelopers #100DaysOfCode #developers
Mohammad Haris ⚡
Shoutout to my favorite array helper in Laravel 🔀 Arr::random returns one or multiple random values from an array. Unlike the native array_rand which return a random key.
#Laravel tip: Need a quick and easy solution for defining a user as an admin without creating migrations and adding to the database?
🌶️ #Laravel Tip: Come and learn about 𝙁𝙡𝙪𝙚𝙣𝙩, a hidden gem in Laravel! You use a Fluent class to wrap over an Array.
✅ Safe access to elements
✅ Array-Like or stdClass-Like access
Bilal Haidar - Available 4 Laravel gigs
New Arr::keyBy() method added in #Laravel 9.2
Yesterday, a really useful PR got merged into Laravel!
It adds a "required_array_keys" validation rule. The rule checks that all of the specified keys exist in an array.
I can already think of a few places in my projects where I could use this myself 🚀
Ash Allen 🚀
Array destructuring is probably one of my favorite things in modern PHP and I don't think I use it enough
Apr 6th, 2022
Validating arrays and nested values in Laravel
Validating arrays and nested values allows you to more effectively deal with data transmitted from your frontend.