Data access

Query builders, eager loading, and transactional writes in Atlas 3.

Atlas Data provides a fluent query layer over SQL databases. Version 3 unifies eager loading syntax and removes the legacy Collection helpers from 2.x.

Query example

phpExample
$projects = Project::query()
    ->with('owner')
    ->where('status', 'active')
    ->paginate(25);

Transactions

phpapp/Services/ProjectService.php
atlas_db()->transaction(function () {
    $project = Project::create([...]);
    $project->members()->attach($userId, ['role' => 'owner']);
});
Tip
Always wrap multi-table writes in a transaction. Partial failures are the leading cause of support tickets after 2.x → 3.x upgrades.
Tquery=O(n)+O(logm)T_{query} = O(n) + O(\log m)

Updated Aug 5, 2026