Tag

Eloquent

0 views collected around this technical thread.

php中文网 Courses
php中文网 Courses
Apr 17, 2025 · Backend Development

10 Common Mistakes to Avoid in Laravel Development

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.

EloquentLaravelPHP
0 likes · 8 min read
10 Common Mistakes to Avoid in Laravel Development
php中文网 Courses
php中文网 Courses
Nov 28, 2024 · Backend Development

Comparing PHP 8.4 Property Hooks with Laravel Eloquent Mutators

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.

EloquentLaravelMutators
0 likes · 8 min read
Comparing PHP 8.4 Property Hooks with Laravel Eloquent Mutators
php中文网 Courses
php中文网 Courses
Jun 27, 2024 · Backend Development

Observer Design Pattern in Laravel: Concepts and Implementation

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
Observer Design Pattern in Laravel: Concepts and Implementation
php中文网 Courses
php中文网 Courses
Apr 28, 2024 · Backend Development

Using Laravel Scout for Full-Text Search in Laravel Applications

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.

EloquentFull-Text SearchLaravel
0 likes · 8 min read
Using Laravel Scout for Full-Text Search in Laravel Applications
php中文网 Courses
php中文网 Courses
Feb 21, 2024 · Backend Development

Deep Dive into Laravel Accessors and Mutators

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
Deep Dive into Laravel Accessors and Mutators
php中文网 Courses
php中文网 Courses
Feb 6, 2024 · Backend Development

Method‑Based Model Casting in Laravel 11

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.

AttributeEloquentLaravel
0 likes · 7 min read
Method‑Based Model Casting in Laravel 11
php中文网 Courses
php中文网 Courses
Feb 5, 2024 · Backend Development

Understanding Laravel Eloquent ORM: with vs load Relationship Loading Methods

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
Understanding Laravel Eloquent ORM: with vs load Relationship Loading Methods
php中文网 Courses
php中文网 Courses
Feb 2, 2024 · Backend Development

Comprehensive Laravel Guide: Best Practices, Controllers, Eloquent ORM, Queues, Security, and Performance Optimization

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
Comprehensive Laravel Guide: Best Practices, Controllers, Eloquent ORM, Queues, Security, and Performance Optimization
php中文网 Courses
php中文网 Courses
Jan 31, 2024 · Backend Development

Understanding and Implementing Laravel Scopes for Eloquent Models

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.

EloquentLaravelPHP
0 likes · 13 min read
Understanding and Implementing Laravel Scopes for Eloquent Models
php中文网 Courses
php中文网 Courses
Dec 26, 2023 · Backend Development

Advanced Laravel Development: Best Practices and Common Pitfalls

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.

EloquentLaravelMVC
0 likes · 9 min read
Advanced Laravel Development: Best Practices and Common Pitfalls
php中文网 Courses
php中文网 Courses
Aug 25, 2021 · Backend Development

Laravel Batch Update Multiple Records with SQL Injection Prevention

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
Laravel Batch Update Multiple Records with SQL Injection Prevention
Laravel Tech Community
Laravel Tech Community
Apr 23, 2021 · Backend Development

Common Laravel and PHP Interview Questions and Answers

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.

EloquentInterviewLaravel
0 likes · 23 min read
Common Laravel and PHP Interview Questions and Answers
php中文网 Courses
php中文网 Courses
Apr 20, 2021 · Backend Development

Laravel: Retrieve the Last Executed SQL Query and Bindings with Code Examples

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.

DatabaseEloquentLaravel
0 likes · 4 min read
Laravel: Retrieve the Last Executed SQL Query and Bindings with Code Examples
php中文网 Courses
php中文网 Courses
Jan 22, 2021 · Backend Development

Laravel Eloquent Model Tips: Selecting Attributes, Cloning, Comparing, Refreshing, Updating Relations, Soft Deletes, and Change Detection

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.

DatabaseEloquentLaravel
0 likes · 5 min read
Laravel Eloquent Model Tips: Selecting Attributes, Cloning, Comparing, Refreshing, Updating Relations, Soft Deletes, and Change Detection
php中文网 Courses
php中文网 Courses
Oct 30, 2020 · Backend Development

Common Laravel Collection Methods and Their Usage

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.

CollectionsEloquentLaravel
0 likes · 10 min read
Common Laravel Collection Methods and Their Usage
Laravel Tech Community
Laravel Tech Community
Jun 13, 2020 · Backend Development

One-to-Many Relationships in Laravel Eloquent

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.

EloquentLaravelORM
0 likes · 5 min read
One-to-Many Relationships in Laravel Eloquent
Laravel Tech Community
Laravel Tech Community
Jun 13, 2020 · Backend Development

Inserting and Updating Related Models with Laravel Eloquent

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.

DatabaseEloquentLaravel
0 likes · 7 min read
Inserting and Updating Related Models with Laravel Eloquent
Laravel Tech Community
Laravel Tech Community
Jun 13, 2020 · Backend Development

Understanding Eager Loading in Laravel Eloquent

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.

Eager LoadingEloquentLaravel
0 likes · 6 min read
Understanding Eager Loading in Laravel Eloquent
Laravel Tech Community
Laravel Tech Community
Jun 13, 2020 · Backend Development

Understanding Laravel Eloquent Relationships: HasManyThrough, Polymorphic, and Advanced Query Techniques

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.

DatabaseEloquentLaravel
0 likes · 11 min read
Understanding Laravel Eloquent Relationships: HasManyThrough, Polymorphic, and Advanced Query Techniques