Vigyata.AI
Is this your channel?

New Way To Disable Foreign Key Constraints - 3 New Things Added - New in Laravel 9.48.0

1.5K views· 52 likes· 5:17· Jan 30, 2023

🛍️ Products Mentioned (7)

Here, we will be looking at 3 new things that are added to the latest version of Laravel which is v9.48.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 === https://github.com/laravel/framework/compare/v9.47.0...v9.48.0 00:00 Intro 00:08 Add withoutForeignKeyConstraints() to disable foreign key constraints in a callback https://github.com/laravel/framework/pull/45601 02:44 Add "incrementEach" to the Query\Builder https://github.com/laravel/framework/pull/45577 04:29 Add notFound helper to Http Client response https://github.com/laravel/framework/pull/45681 === 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

Hey guys, welcome to Laratips. In this video I’m covering what’s new in Laravel v9.48.0, and I walk you through the practical side of three additions that can make your day-to-day code cleaner. I start with a super common migration/database pain: dropping tables when foreign key constraints are in the way. Previously, you had to manually disable and then re-enable constraints around your operation. Now we have Schema::withoutForeignKeyConstraints(), where I can wrap the drop (or any schema operation) inside a callback, and Laravel handles the disable/enable for me automatically. Next, I show the new incrementEach method on the query builder. If you’ve ever needed to increment multiple columns (like my demo “cash_in” and “cash_out”), earlier you’d either run increment twice (two queries) or do a manual fetch/update/save. With incrementEach, I can increment multiple columns in a single query, which is cleaner and more efficient. Finally, I cover a small but nice HTTP Client improvement: the notFound() helper on the response. Instead of checking $response->status() === 404, I can just call $response->notFound(). Same behavior, better readability—exactly the kind of tiny upgrade I like in Laravel releases.

Frequently Asked Questions

🎬 More from Laratips