Tagged articles
Eloquent
36 articles · Page 1 of 1
This article highlights ten frequent Laravel mistakes—from N+1 queries and missing transactions to improper caching and lack of performance monitoring—explaining why they occur and providing concrete code examples of best‑practice solutions to improve efficiency, security, and maintainability.
BackendBest PracticesEloquent
0 likes · 8 min read

This article outlines ten frequent Laravel pitfalls—from neglecting mass‑assignment protection and overusing query builders to ignoring exception handling and security best practices—providing clear explanations and corrected code examples to help developers write more efficient, secure, and maintainable applications.
Best PracticesEloquentLaravel
0 likes · 8 min read

This article examines PHP 8.4's new Property Hooks feature, compares it with Laravel Eloquent's Mutators, provides implementation examples for both, and offers guidance on when to prefer each approach based on project requirements and performance considerations.
BackendEloquentLaravel
0 likes · 8 min read

This article explains the Observer design pattern, its role in reducing coupling, and demonstrates how to implement it in Laravel using Eloquent model events, including creating observers, registering them, and practical use cases such as activity logging, email notifications, and slug generation.
EloquentLaravelObserver Pattern
0 likes · 12 min read

This guide explains how to install, configure, and use Laravel Scout to add powerful full-text search capabilities to Laravel models, covering driver setup, searchable traits, indexing, custom queries, conditional searching, pagination, and result display.
EloquentLaravelPHP
0 likes · 8 min read

This article provides an in‑depth exploration of Laravel’s Eloquent Accessors and Mutators, explaining their purpose, demonstrating advanced usage with price conversion, encryption, hashing, and offering practical blog‑model examples such as title casing, excerpt generation, date formatting, slug creation, and email normalization to ensure data integrity.
AccessorsEloquentLaravel
0 likes · 6 min read

This article walks through Laravel's full‑stack design, showcasing Artisan commands, model generation, migrations, Eloquent relationships, routing, testing, and core container mechanics while highlighting practical code examples and the trade‑offs that make Laravel both powerful and occasionally heavyweight.
ArtisanEloquentLaravel
0 likes · 25 min read

Laravel 11 introduces a method‑based model casting system that replaces the traditional $casts property, allowing developers to define type conversions via Attribute methods, which improves code clarity, flexibility, testability, and overall maintainability of Eloquent models.
EloquentLaravelLaravel 11
0 likes · 7 min read

This article explains Laravel's Eloquent ORM relationship loading methods, comparing the eager-loading `with` function and the lazy-loading `load` function, detailing their mechanisms, advantages, cautions, appropriate use cases, and providing practical code examples for backend developers.
EloquentLaravelLoad
0 likes · 8 min read

This guide provides a thorough overview of Laravel development, covering MVC fundamentals, proper use of controllers, services, repositories, request validation, traits, Eloquent ORM operations, queue handling for emails, security measures, CSRF protection, performance tuning, and recommended learning resources, all illustrated with practical code examples.
EloquentLaravelPHP
0 likes · 16 min read

Laravel Scopes provide a powerful mechanism to define reusable query constraints for Eloquent models, covering global, local, anonymous, and dynamic scopes, with step‑by‑step instructions on creation, application, removal, and best practices, enhancing code reuse, readability, and maintainability in backend development.
BackendEloquentLaravel
0 likes · 13 min read

This article guides developers on becoming advanced Laravel programmers by explaining the framework’s ecosystem, naming conventions, effective use of Eloquent ORM and relationships, applying the DRY principle, separating business logic, and offering optimization tips, all illustrated with correct and incorrect code examples.
Best PracticesEloquentLaravel
0 likes · 9 min read

This article demonstrates how to implement a safe batch‑update method for Laravel's Eloquent models that prevents SQL injection, provides the full PHP implementation, usage example, and the resulting SQL statement, highlighting the performance benefits over individual updates.
Batch UpdateEloquentLaravel
0 likes · 4 min read

This article compiles frequently asked Laravel and PHP interview questions, providing concise explanations of core concepts such as the framework's architecture, routing, middleware, Eloquent ORM, service container, authentication, authorization, testing tools, and deployment practices, useful for both beginners and experienced candidates.
BackendEloquentInterview
0 likes · 23 min read

This article explains how to enable Laravel's query log to capture the most recent SQL statement and its bound values, demonstrates extracting specific order data, using updateOrCreate for conditional inserts or updates, building complex sub‑queries with multiple conditions, and executing raw SQL fragments via selectRaw.
EloquentLaravel
0 likes · 4 min read

This article presents a collection of practical Laravel Eloquent model techniques, including selecting specific attributes with find, cloning models via replicate, comparing models with is, refreshing and reloading records, updating related models with push, customizing soft‑delete columns, and detecting attribute changes using getChanges, getDirty, and getOriginal.
BackendEloquentLaravel
0 likes · 5 min read

This tutorial explains Laravel's powerful Collection class, demonstrating how to create collections with the collect helper and use methods such as filter, search, chunk, map, zip, whereNotIn, max, pluck, each, tap, pipe, contains, forget, and avg to manipulate data without additional database queries.
BackendData ManipulationEloquent
0 likes · 10 min read

This article explains how to define and use Laravel Eloquent relationships—including one-to-one, inverse, and default model handling—by showing the necessary model methods, query constraints, and code examples for both sides of the association.
BackendEloquentLaravel
0 likes · 6 min read

This article explains how to add, update, and manage related Eloquent models in Laravel—including saving single or multiple related records, using associate/dissociate for belongsTo relations, and handling many‑to‑many pivots with attach, detach, sync, toggle, and timestamp propagation.
BackendEloquentLaravel
0 likes · 7 min read

This article explains Laravel Eloquent's eager loading techniques, demonstrating how to replace lazy-loaded N+1 queries with the with() method, preload multiple or nested relationships, select specific columns, apply constraints, and use lazy eager loading methods like load and loadMissing, all illustrated with PHP code examples.
BackendEager LoadingEloquent
0 likes · 6 min read

This article explains how to define and use Laravel Eloquent relationships—including remote one‑to‑many (hasManyThrough), polymorphic, many‑to‑many polymorphic, and various query constraints—by showing required database schemas, model methods, and example code for retrieving and counting related records.
EloquentLaravelORM
0 likes · 11 min read

This article explains how to define many-to-many relationships in Laravel's Eloquent ORM, covering the required pivot table, model methods, query constraints, pivot customization, and the use of custom pivot models with code examples.
EloquentLaravelORM
0 likes · 6 min read

This article explains how to define and use one-to-many and inverse (belongsTo) relationships in Laravel's Eloquent ORM, including default foreign key conventions, accessing related records, applying query constraints, and customizing foreign and local keys with code examples.
BackendEloquentLaravel
0 likes · 5 min read

This tutorial explains how Laravel Eloquent returns collections, how to create collections with the collect helper, and demonstrates essential collection methods such as filter, search, chunk, zip, map, each, tap, pipe, contains, whereNotIn, max, pluck, and avg, complete with code examples and expected outputs.
BackendData ManipulationEloquent
0 likes · 11 min read

This cheat sheet provides a concise yet comprehensive guide to Laravel's Eloquent Model, covering definition, artisan commands, common CRUD methods, soft‑deletes, relationship types, model events, and configuration tips, all illustrated with ready‑to‑copy code examples.
BackendEloquentLaravel
0 likes · 9 min read

Laravel 7 builds on the 6.x release with a host of backend enhancements such as Laravel Sanctum (Airlock), faster route matching, custom Eloquent casts, Blade component tags, improved string helpers, a native HTTP client, CORS support, route‑model binding upgrades, queue and mail driver improvements, plus new artisan commands and various bug fixes.
APIBackendEloquent
0 likes · 5 min read

Learn how Laravel Eloquent’s accessors and mutators let you automatically format attribute values, how to define custom getters and setters, configure date conversion with Carbon, customize date formats, and use the $casts property to transform JSON, arrays, booleans, and other data types.
AccessorsAttribute CastingEloquent
0 likes · 7 min read

This guide explains Laravel Eloquent's relationship types—including one-to-one, one-to-many, many-to-many, polymorphic and has‑many‑through—showing how to define, query, preload, and manipulate them with PHP code examples and detailed explanations for backend development in applications.
BackendEloquentLaravel
0 likes · 26 min read

This tutorial explains how to configure Laravel's Eloquent ORM, create and customize model classes, manage table names, primary keys, timestamps, perform queries, insert, update, delete records, handle soft deletes, apply global and local scopes, and work with model events and observers, all with practical PHP code examples.
EloquentLaravelModel
0 likes · 22 min read

This guide explains how Laravel Eloquent can serialize models and their relationships to arrays or JSON, control visible and hidden attributes, append custom values, and customize date formatting using casts and Carbon serialization, with practical code examples for each feature.
BackendEloquentJSON
0 likes · 7 min read

This article explains how Laravel Eloquent returns Collection objects, demonstrates iterating and chaining collection methods such as reject and map, lists the extensive base collection API, and shows how to create custom collections by overriding the newCollection method in a model.
EloquentLaravelORM
0 likes · 5 min read

This guide explains how Laravel’s query builder offers a secure, fluent interface for constructing and executing database queries, covering result retrieval, filtering, aggregation, joins, unions, inserts, updates, deletes, and advanced features like raw expressions, JSON handling, and pessimistic locking.
CRUDEloquentLaravel
0 likes · 20 min read

This guide explains how Laravel's paginator integrates with the query builder and Eloquent ORM, shows basic and simple pagination methods, demonstrates manual paginator creation, customizing URIs, appending parameters, converting results to JSON, and customizing pagination views, all with code examples compatible with Bootstrap.
EloquentLaravelPHP
0 likes · 10 min read

This guide introduces Laravel's Eloquent ORM, explains its core concepts, and provides step‑by‑step code examples for retrieving, querying, and sorting records, helping developers harness the power of object‑relational mapping in PHP applications.
EloquentLaravelORM
0 likes · 4 min read

Discover a collection of ten practical Eloquent ORM techniques—including increment/decrement shortcuts, conditional method chaining, boot method customizations, advanced relationship queries, and the when() helper—that empower Laravel developers to write cleaner, more efficient database code and avoid common pitfalls.
EloquentLaravelORM
0 likes · 6 min read

This article explains Laravel's Query Builder and Eloquent ORM, showing how to convert raw SQL into fluent builder methods, create database tables and models, and demonstrate practical querying techniques with nested conditions, aggregation, and result handling.
EloquentLaravelORM
0 likes · 9 min read
