Name connections by responsibility
main can serve application writes while reporting serves analytics. A named connection makes the choice visible and prevents a feature from silently using the wrong database.
aml install data --driver sqlite
$active = $context->set(User::class)
->where('active', '=', true)
->orderBy('name')
->paginate(1, 20);Compose queries with DbSet
where, orderBy, whereIn, with, limit, find, first, count, and paginate return predictable results. Query objects are cloned as they change, so a base query can be reused safely.
Validate entities before persistence
Required, Email, and Length attributes reject invalid entities before persistence. Database constraints remain necessary because they protect every writer, not only this application.