Writing

Tips & Tricks

Quick, practical code snippets and solutions.

8 tips

Feb 9, 2026·1 min read·Laravel

Laravel required_array_keys Validation

required_array_keys validation rule for array validation. Learn setup, use cases, and practical examples for API requests, settings, and nested data validation.

→
Feb 6, 2026·2 min read·Laravel

Laravel Conditional Migrations: shouldRun()

Laravel's shouldRun() method in migrations for feature flags, conditional execution, environment-based migrations, and staged deployments.

→
Feb 5, 2026·1 min read·Laravel · Database

Laravel: Use DB Transactions

Learn Laravel database transaction tips including automatic rollback, deadlock handling, manual control, and best practices for data integrity.

→
Feb 4, 2026·2 min read·Laravel

Laravel: isDirty() & wasChanged():

Master Laravel's isDirty() and wasChanged() methods for tracking model changes. Learn the difference, use cases, and practical examples .

→
Feb 3, 2026·1 min read·Laravel

Laravel ObservedBy Attribute

Learn how to use Laravel 11+ ObservedBy attribute for cleaner model observers. Includes practical use cases like audit logging, notifications, cache invalidation, and more.

→
Feb 2, 2026·1 min read·Laravel

Laravel: Use when() to Avoid Ugly Conditional Queries

Laravel’s when() method to write clean conditional queries, avoid messy if-statements, and build dynamic filters for search, APIs, and advanced query logic.

→
Feb 1, 2026·4 min read·Laravel

Laravel Context: Share Data Across Your Request Lifecycle

Laravel Context is a powerful feature that allows you to capture, retrieve, and share information throughout your application's request lifecycle, including jobs and queued tasks.

→
Jan 31, 2026·2 min read·Laravel

Master Laravel's updateOrCreate() for Smarter Database Operations

Stop writing repetitive if-else logic to check if records exist before updating or creating them. Laravel's updateOrCreate() method handles both operations intelligently in a single, elegant call.

→