Laravel Tips
  • Home
  • PHP
  • Laravel
    • Models
    • Helpers
    • Security
    • Laravel Eloquent
    • Laravel Updates
  • MySQL
  • CheatSheet
  • About
  • Contact

Type and hit Enter to search

Laravel Tips
  • Home
  • PHP
  • Laravel
    • Models
    • Helpers
    • Security
    • Laravel Eloquent
    • Laravel Updates
  • MySQL
  • CheatSheet
  • About
  • Contact

Follow Us

Laravel Tips
  • Home
  • PHP
  • Laravel
    • Models
    • Helpers
    • Security
    • Laravel Eloquent
    • Laravel Updates
  • MySQL
  • CheatSheet
  • About
  • Contact

Type and hit Enter to search

Laravel Tips
  • Home
  • PHP
  • Laravel
    • Models
    • Helpers
    • Security
    • Laravel Eloquent
    • Laravel Updates
  • MySQL
  • CheatSheet
  • About
  • Contact

Follow Us

Laravel

Laravel Development Services: The Complete Guide to Building Scalable Web Applications in 2026

Table of Contents Introduction What Is Laravel? Why Choose Laravel for Web Development What Are...

Read More
How to Check Laravel Version
How to Check Laravel Version in CMD: A Step-by-Step Guide
November 27, 2024
How to check the Laravel version?
How to check the Laravel version?
December 17, 2023

Recent Tips

The Ultimate Guide to PDF Upload Using Vue.js

The Ultimate Guide to PDF Upload Using Vue.js

Jagdish Chaudhary, CSPO®️
December 1, 2023
How to Choose the Right Laravel Development Company

How to Choose the Right Laravel Development Company

Jagdish Chaudhary, CSPO®️
November 17, 2023
How to Implement Email Verification in Laravel Breeze

How to Implement Email Verification in Laravel Breeze

Jagdish Chaudhary, CSPO®️
October 23, 2023
Laravel Where IN

How to Use Laravel Where In to Filter Your Database Queries

Jagdish Chaudhary, CSPO®️
October 21, 2023
How to Use Agora Web SDK to Add Real-Time Video and Audio to Laravel Apps

How to Use Agora Web SDK to Add Real-Time Video and Audio to Laravel Apps

Jagdish Chaudhary, CSPO®️
October 11, 2023
How to Delete Pivot Tables in Laravel

How to Delete Pivot Tables in Laravel: A Comprehensive Guide

Jagdish Chaudhary, CSPO®️
September 29, 2023

Recent Tips

Laravel Where IN
21 Oct
Laravel Eloquent

How to Use Laravel Where In to Filter Your Database Queries

How to Use Agora Web SDK to Add Real-Time Video and Audio to Laravel Apps
11 Oct
Laravel

How to Use Agora Web SDK to Add Real-Time Video and Audio to Laravel Apps

How to Delete Pivot Tables in Laravel
29 Sep
Laravel

How to Delete Pivot Tables in Laravel: A Comprehensive Guide

How to fix the Could Not Find Driver error in Laravel
23 Sep
Laravel

How to fix the “Could Not Find Driver” error in Laravel

More Posts

Instagram Feed

laraveltips.io

Eager loading fixed your query count. It never fix Eager loading fixed your query count. It never fixed the hydration.

You write User::with('orders') so a table can show a last order date. Laravel runs two queries, then builds every Order model behind them. Fifty users with forty orders each is 2,000 objects created, cast and held in memory so you can read fifty timestamps.

A select subquery asks the database for the value instead of the rows.

User::addSelect(['last_order_at' => Order::select('created_at')
 ->whereColumn('user_id', 'users.id')
 ->latest()
 ->limit(1)])

Three rules that make it work:

1. One column, one row. select() a single column and limit(1), or the database rejects it.
 2. Correlate with whereColumn and qualify the outer side as users.id. Plain where() compares against the literal string and quietly returns nothing.
 3. What comes back is an attribute, not a relation. Cast it with withCasts(['last_order_at' => 'datetime']).

Then the payoff eager loading cannot reach: pass the same subquery to orderByDesc and you can sort a paginated list by a relation's value. Sorting the collection only reorders the page you already fetched, so your most recent customer stays on page 12.

One caveat, stated plainly: the subquery runs per candidate row, so index orders on (user_id, created_at). Without that index you have moved the cost, not removed it.

Keep with() when you need several fields, an accessor, or more than one related row. Reach for the subquery when you need one value.

Where in your codebase are you loading whole rows to read a single field?

#laravel #eloquent #php #backend #database sql performance laraveltips
🚀 Laravel Tip: Simplify your debugging process wit 🚀 Laravel Tip: Simplify your debugging process with `->dd()`! 💡 
No need for separate `dd($result)` calls - just chain it at the end of your Eloquent queries for instant insights. 🐞🔍 #Laravel #DebuggingHacks #CodingTips #laraveltips #php #webdeveloper #eloquent #codeigniter
6 Must Know features for every #laravel developer 6 Must Know features for every #laravel developer 

#laraveltips #laraveldevelopers #programmer #code #php #mysql #artisan
Unique jobs keep the first dispatch. Debounced job Unique jobs keep the first dispatch. Debounced jobs keep the last.

Laracon US 2026 shipped a long list. The one that changes your code on Monday is debounced jobs.

Five rapid edits to a product are one reason to reindex, not five. ShouldBeUnique rejects the newcomer, so the first payload wins and your index goes stale. #[DebounceFor] replaces the pending job, so the latest payload wins once the window closes.

Put #[DebounceFor(30, maxWait: 120)] on the job, add a debounceId() to group by, then dispatch on every save. The old shape — a cache key, a delayed job, a manual freshness check — disappears.

Two constraints worth knowing. Debouncing needs a cache driver with atomic locks, and every dispatching server has to share one central store. DebounceFor and ShouldBeUnique cannot sit on the same class.

Where would you swap first-wins for last-wins in your own code?

#laravel #php #laracon queues backend webdev laraveltips
🚀 Did you know Laravel 12 just made form validatio 🚀 Did you know Laravel 12 just made form validation even safer?
One line of code to keep your inputs clean and your app secure 🔒

Stop over-validating — just use:
secureValidate() 💪

💡 More quick Laravel + PHP gems coming your way!

👉 Follow @laraveltips.io and visit 🌐 laraveltips.io
 for more real-world tips, snippets, and tutorials.

#laravel12 #laraveltips #WebSecurity #PHPDevelopers #CodingReels #webdev #codewithme #devcommunity #laravelcommunity #webdevelopmentcourse #programmerlife #LearnLaravel #LaravelDeveloper #PHP #laraveltipsio
🚀 Laravel 12 just made query writing feel like che 🚀 Laravel 12 just made query writing feel like cheating 😎

nestedWhere() = cleaner code, faster performance, fewer headaches.

Say goodbye to messy closures 👋 and hello to elegant one-liners 💻

💡 Learn the full breakdown + code examples on my website 👇
🌐 laraveltips.io

—
🧠 Follow @laraveltips.io for Laravel gems, web dev hacks & real-world tutorials ⚡

#laravel12 #laraveltips #webdevelopment #phpdevelopers #laravelcommunity #cleancode #fullstackdev #codingdaily #laravelindia #codesmart #programminglife #devcommunity #techreels #codebetter #webdevjourney #softwareengineer #laraveldevelopers #codingvibes #WebDevIndia #LaravelNation #devlifestyle #codewithstyle #techcreators
A Beginner's guide to Docker, We have complete do A Beginner's guide to Docker,

We have complete docker tutorial available on our site, LaravelTips.io

#laravel  #docker #devops #devopsjobs #Security #laraveltips  #Technology #Programming #php #webdev
If you're a developer, and you have a macbook, and If you're a developer,
and you have a macbook,
and you have recently installed Homebrew by searching on Google,

You might be in trouble.

The first result was showing a Sponsored link which seemed legit at first sight.

But when you clicked on it, the URL was not the official Homebrew's website (brewe.sh ❌ vs brew.sh ✅).

Google seems to allow to set a different display URL than the actual one when you create a sponsored link (congrats PO/Marketing Genius who came up with this idea).

If you've executed the curl command from this compromised website, take action now.
⚽️ Ever feel like your Laravel mistakes come back ⚽️ Ever feel like your Laravel mistakes come back to hit you… hard? 💥 Don’t let broken routes knock you out! 🛑 Here’s a quick fix for 404 errors that’ll keep your code on target! 🎯 #LaravelTips #CodeFix #404Error #DeveloperLife
Follow on Instagram

Follow Us

Linkedin Twitter Facebook Instagram

Laravel Tips

How to Implement Email Verification in Laravel Breeze
How to Implement Email Verification in Laravel Breeze
Jagdish Chaudhary, CSPO®️
How to Use Agora Web SDK to Add Real-Time Video and Audio to Laravel Apps
How to Use Agora Web SDK to Add Real-Time Video and Audio to Laravel Apps
Jagdish Chaudhary, CSPO®️
How to Delete Pivot Tables in Laravel
How to Delete Pivot Tables in Laravel: A Comprehensive Guide
Jagdish Chaudhary, CSPO®️
How to fix the Could Not Find Driver error in Laravel
How to fix the “Could Not Find Driver” error in Laravel
Jagdish Chaudhary, CSPO®️
Load More

Featured Tips

LaravelTips Array Helpers
Boost Your Laravel skills with these powerful Array Helper functions! 
Jagdish Chaudhary, CSPO®️
January 25, 2023
Laravel request lifecycle
Laravel Request Lifecycle
Jagdish Chaudhary, CSPO®️
February 20, 2023
loop/entry/iteration is first or last,
Check if the current loop/entry/iteration is first or last,
Jagdish Chaudhary, CSPO®️
February 24, 2023
Don't Break Your Laravel Code, Avoid ENV calls 1
Laravel Best Practices: Limiting env Calls to Config Files for Better Performance and Stability
Jagdish Chaudhary, CSPO®️
February 26, 2023
How to Simplify Laravel Development with Docker
How to Simplify Laravel Development with Docker
Jagdish Chaudhary, CSPO®️
February 28, 2023
Exploring Advanced Subdomain Routing Techniques in Laravel: A Complete Tutorial
Exploring Advanced Subdomain Routing Techniques in Laravel: A Complete Tutorial
Jagdish Chaudhary, CSPO®️
March 1, 2023
Laravel Tips
  • PHP
  • Laravel
  • Models
  • Helpers
  • Security
  • MySQL
  • Cheatsheet
  • Helpers
  • Contact
Instagram Facebook Linkedin Twitter

Precise Developers © 2026. All Rights Reserved.