Skip to main content
InterviewHubPRO
Section Overview
Q7

Question 7 of 50

Part 1: Architecture, Service Container & Request Lifecycle (1 - 10)

14%
Laravel & Ecosystem (50 Qs)•Part 1: Architecture, Service Container & Request Lifecycle (1 - 10)

What is Eloquent ORM and the Active Record Pattern?

senior LevelCode ExampleLifecycleDocker & ContainersSystem Design

In Simple Words: Eloquent is Laravel's built-in Object-Relational Mapper (ORM) implementing the Active Record Pattern:

  • Each database table corresponds to a Model class (User -> users table).
  • An instance of a model represents a single row in that table.
  • Database operations are invoked directly on the model instance:
php
$user = User::find(1);
$user->email = 'new@example.com';
$user->save(); // Generates UPDATE users SET email = ... WHERE id = 1