Tags

Here is all articles with laravel tag

Laravel #[CurrentUser] Attribute
laravel
July 7, 2026 8 minutes reading time

Laravel #[CurrentUser] Attribute

Starting with Laravel 12, Laravel introduced the #[CurrentUser] attribute, making it easier to access the authenticated user inside controller methods. Instead of retrieving the user manually using Request object or auth() helper, you can now ask Laravel to inject the authenticated user directly into your method. This results in cleaner, more readable controller code while […]

Laravel $this->columnName vs $this->attributes[‘columnName’]
laravel
June 21, 2026 8 minutes reading time

Laravel $this->columnName vs $this->attributes[‘columnName’]

When working with Eloquent models in Laravel, you may have seen both of these approaches used to access model attributes: Although they may seem identical, they behave differently under the hood. Understanding the difference is especially important when creating custom accessors, mutators, casts, and model attributes. # Quick Answer The main difference is $this->columnName passes […]

Laravel Bulk Update vs Save: Why Observer Events Are Not Triggered
laravel
June 6, 2026 8 minutes reading time

Laravel Bulk Update vs Save: Why Observer Events Are Not Triggered

When working with Laravel, performance is often a major concern. One common optimization is using bulk updates instead of loading and updating models one by one. However, there is an important behavior that many developers overlook: Laravel Observer events are not triggered when using bulk update queries. If your application relies on observers for logging, […]

Laravel vs WordPress: Which One Should You Choose in 2026?
laravel
May 14, 2026 8 minutes reading time

Laravel vs WordPress: Which One Should You Choose in 2026?

When developers and business owners start a new web project, one question appears again and again: should you use Laravel or WordPress? At first glance, the comparison may seem unfair. After all, Laravel is a PHP framework, while WordPress is known as a CMS (Content Management System). But the reality is more interesting. Modern WordPress […]

Clean Up Your Blade Templates with Laravel’s $loop Variable
laravel
May 8, 2026 8 minutes reading time

Clean Up Your Blade Templates with Laravel’s $loop Variable

If you work with Laravel Blade templates, one feature that can make your views much cleaner is the built-in $loop variable inside the @foreach directive Many developers manually create counters or extra conditions inside loops, while Laravel already provides a powerful helper for this. Here’s a simple example: In this example, $loop->iteration gives you the […]

Controller Naming in MVC
laravel
May 2, 2026 8 minutes reading time

Controller Naming in MVC

Confused about naming your controllers? You’re not alone !! Sometimes you may hesitate when naming controllers in Laravel:should it be singular or plural? According to Laravel best practices, controllers should be named in singular form. Recommended examples: Not recommended examples: Laravel follows a clear and predictable pattern: #Why Singular? A controller represents a resource, not […]

How to redirect in a cleaner and readable way in Laravel
laravel
April 10, 2026 8 minutes reading time

How to redirect in a cleaner and readable way in Laravel

Learn the difference between Laravel to_route() and redirect()->route() and understand when to use each method in modern Laravel applications.