Introduction to Design Patterns in Laravel

Posted by - 20/11/2024

This article is part of our comprehensive series on Design Patterns in Laravel: Introduction to Design Patterns in Laravel (Current Article) Understanding the Singleton Pattern in Laravel Implementing the Factory Pattern for Flexible Object Creation Leveraging the Adapter Pattern for Third-Party Integrations Enhancing Functionality with the Decorator Pattern Optimizing Communication Using the Observer Pattern Simplifying

Exploring the Differences Between Two Laravel Update Methods

Posted by - 06/04/2023

When working with Laravel, one of the most common tasks is updating records in the database. Laravel provides a convenient and elegant way to accomplish this through the Eloquent ORM (Object-Relational Mapping). In this blog post, we’ll explore the differences between two popular methods of updating records: Product::where(‘id’, 1)->update([‘stock_left’ => 1]) and Product::find(1)->update([‘stock_left’ => 1]).