Skip to content

Commit ad3ae86

Browse files
authored
Remove the use of load(on:) in relations.md
1 parent fafc8ba commit ad3ae86

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/fluent/relations.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ See [query](query.md) for more information.
283283

284284
## Eager Loading
285285

286-
Fluent's query builder allows you to preload a model's relations when it is fetched from the database. This is called eager loading and allows you to access relations synchronously without needing to call [`load`](#lazy-eager-loading) or [`get`](#get) first.
286+
Fluent's query builder allows you to preload a model's relations when it is fetched from the database. This is called eager loading and allows you to access relations synchronously without needing to call [`get`](#get) first.
287287

288288
To eager load a relation, pass a key path to the relation to the `with` method on query builder.
289289

@@ -331,16 +331,16 @@ The `with` method accepts an optional closure as a second parameter. This closur
331331

332332
## Lazy Eager Loading
333333

334-
In case that you have already retrieved the parent model and you want to load one of it's relations, you can use the `load(on:)` method for that purpose. This will fetch the related model from the database and allows it to be accessed as a local property.
334+
In case that you have already retrieved the parent model and you want to load one of it's relations, you can use the `get(on:)` method for that purpose. This will fetch the related model from the database (or cache, if available) and allows it to be accessed as a local property.
335335

336336
```swift
337-
planet.$star.load(on: database).map {
337+
planet.$star.get(on: database).map {
338338
print(planet.star.name)
339339
}
340340

341341
// Or
342342

343-
try await planet.$star.load(on: database)
343+
try await planet.$star.get(on: database)
344344
print(planet.star.name)
345345
```
346346

0 commit comments

Comments
 (0)