Eloquent will happily run a query the moment you touch $book->loans. That convenience is also how a list page ends up running 200 queries. Laravel Rust, the Rust version of Laravel that went into beta on 1 December 2026, takes the opposite position: a relationship is never loaded unless you asked for it.
Here's what that looks like in practice, using a small library app: branches hold books, members borrow them, and books have authors.
Relationships are struct fields
In Eloquent a relationship is a method. In Laravel Rust it's a field with an attribute, and the type says what's in it:
use laravel::model::{BelongsTo, HasMany, model}; use crate::models::{Branch, Loan}; #[model] pub struct Book { pub id: i64, pub branch_id: i64, pub title: String, #[belongs_to] pub branch: BelongsTo<Branch>, #[has_many] pub loans: HasMany<Loan>, } The conventions are the Eloquent ones. #[belongs_to] on branch reads branch_id, and #[has_many] on Book expects a book_id column on loans.
Loading is always explicit
You eager-load with with, the same word Eloquent uses, except the relationship names are typed:
let books = Book::query() .filter(Book::branch_id.eq(branch.id)) .with(Book::loans.with(Loan::member)) .get() .await?; That's three queries no matter how many books come back. Book::loans.with(Loan::member) is the typed form of with('loans.member'), so a typo is a compile error instead of an empty collection.
Forget the with, and reading book.loans panics in development with a message that names the fix:
Book::loans isn't loaded; add `.with(Book::loans)` to the query You find out on the first request, not from a slow page in production. For helpers that can't know what the caller loaded, is_loaded() and try_loaded() check without panicking, and load_missing fills in only what's absent.
Constrained eager loads
"Show each branch's next three due dates" is a closure inside with() in Eloquent. In Laravel Rust you pass the closure to the relationship's query method:
let branches = Branch::query() .with(Branch::loans.query(|loans| { loans .filter(Loan::due_at.is_future()) .order_by(Loan::due_at) .limit(3) })) .get() .await?; The limit applies per branch, the same as Eloquent since Laravel 11.
Counting without loading rows
withCount becomes with_count, and the count comes back typed:
let books = Book::query() .with_count(Book::loans) .get() .await?; for book in &books { let times_borrowed = book.loans.count(); } with_sum, with_max, with_min, with_avg and with_exists work the same way.
Nullable relationships are Option
A book that's on the shelf has no current loan. In PHP that's a ?-> you hope you remembered. Here it's in the type:
#[has_one(latest_of_many = Loan::borrowed_at)] pub current_loan: HasOne<Option<Loan>>, That's hasOne()->latestOfMany() ordered by a column, and every caller has to handle the None case before it compiles.
Pivot data gets its own struct
Books and authors are many-to-many through author_book, and some credits are translations. Instead of withPivot('translator') and $author->pivot->translator, the extra columns live in a #[join_row] struct:
use laravel::model::join_row; #[join_row(table = "author_book")] pub struct Credit { #[default] pub translator: bool, } On the model it's the second type parameter, BelongsToMany<Author, Credit>, and after loading you read author.join.translator. A misspelled pivot column doesn't compile. attach, detach, sync and toggle keep their names.
Is it worth the ceremony?
There is more typing up front than $this->hasMany(Loan::class). What you get back is that the N+1 query, the misspelled relationship and the forgotten null check all show up before the code runs. Teams that spend time chasing those in Eloquent apps will probably find the trade reasonable.
Further reading
- Official docs: Model Relationships
- A longer side-by-side with Eloquent covering
hasManyThrough,syncand filtered relationships: Relationships in Laravel Rust, for Eloquent developers