Vigyata.AI
Is this your channel?

Hide or Show Data From Collection - 3 New Things Added - New in Laravel 9.47.0

2.1K views· 59 likes· 2:38· Jan 17, 2023

🛍️ Products Mentioned (6)

Here, we will be looking at 3 new things that are added to the latest version of Laravel which is v9.47.0 === OFFER === GET 30% DISCOUNT ON ALL PLANS OF CLOUDWAYS HOSTING FOR 3 MONTHS https://unified.cloudways.com/signup?id=1029148&coupon=CW30FOR3 === Important Links === Fonts, extensions I use, and Support Laratips links: https://bit.ly/m/laratips === Video Related Links === 00:00 Intro 00:08 Add setVisible and setHidden to Eloquent Collection https://github.com/laravel/framework/pull/45558 01:49 Add Decimal to list of Numeric rules https://github.com/laravel/framework/pull/45533 02:17 Return model when casting attribute https://github.com/laravel/framework/pull/45539 === Other Videos === What's New In Laravel 9 https://youtu.be/qAzrZUG_9Z0 New In Laravel Playlist https://www.youtube.com/playlist?list=PL2DahmvUpeuu4UVWrcxlvVkMiI0SeS2OZ Laravel Package Development Playlist https://www.youtube.com/playlist?list=PL2DahmvUpeuu8HkpbNT-cKernolVdqZq_ Password Validation In Laravel with at least one Letters, Numbers, Upper and Lowercase or Symbols: https://youtu.be/f-g3P9imPZs Multiple Apis With ForwardsCalls Trait And Code Refactoring Tip - Laravel Hidden Feature: https://youtu.be/vzgNm86ezWE Laravel Chunking - You Might Be Doing This Wrong - Problem and Solution: https://youtu.be/aQCHmB4Uh0Q Laravel Tip - Properly Get Data Between Two Dates https://youtu.be/bJkEBTg1NGA Get Data From Multiple Databases In One Project | Laravel Tip https://youtu.be/KJAXLf78QPs === Attribution === Boy waving hand Video by VideoPlasty .com from Pixabay https://pixabay.com/users/videoplasty-19751245/?utm_source=link-attribution&utm_medium=referral&utm_campaign=video&utm_content=80696 #laravel #php #laraveltip #laratips #newinlaravel

About This Video

In this video I’m covering 3 small but super useful changes that landed in Laravel v9.47.0. First one is something I really like: you can now call setVisible() and setHidden() directly on an Eloquent Collection (not the normal Illuminate collection). I show it quickly in Tinker—imagine you already received a collection of users from somewhere, and you want to shape the output after the fact. With setVisible(['id','name']) you can keep only those fields, and with setHidden(['id','name']) you can exclude them and return everything else. Second change is very simple but practical: Decimal is added to the list of numeric validation rules. Because of that, you can now use rules like size, min, and max together with decimal, and those constraints will apply on the numeric value. And the third one is a tiny fix around models: when you set an attribute on a model, it returns the model—but if you had a set attribute cast/mutator, it was returning null. From now on, it will also return the model, which makes chaining and fluent code more consistent.

Frequently Asked Questions

🎬 More from Laratips