diff --git a/eloquent-collections.md b/eloquent-collections.md
index 860a1f7ea8e..114e668f702 100644
--- a/eloquent-collections.md
+++ b/eloquent-collections.md
@@ -242,45 +242,47 @@ The `unique` method returns all of the unique models in the collection. Any mode
## Custom Collections
-If you would like to use a custom `Collection` object when interacting with a given model, you may add the `CollectedBy` attribute to your model:
-
- $models
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public function newCollection(array $models = []): Collection
{
- /**
- * Create a new Eloquent Collection instance.
- *
- * @param array $models
- * @return \Illuminate\Database\Eloquent\Collection
- */
- public function newCollection(array $models = []): Collection
- {
- return new UserCollection($models);
- }
+ return new UserCollection($models);
}
+}
+```
Once you have defined a `newCollection` method or added the `CollectedBy` attribute to your model, you will receive an instance of your custom collection anytime Eloquent would normally return an `Illuminate\Database\Eloquent\Collection` instance.
diff --git a/eloquent.md b/eloquent.md
index 776029bc98b..0c20b694002 100644
--- a/eloquent.md
+++ b/eloquent.md
@@ -1224,40 +1224,42 @@ Writing a global scope is simple. First, use the `make:scope` command to generat
#### Applying Global Scopes
-To assign a global scope to a model, you may simply place the `ScopedBy` attribute on the model:
+To assign a global scope to a model, you may simply place the `ScopedBy` attribute on the model. Or, you may manually register the global scope by overriding the model's `booted` method and invoke the model's `addGlobalScope` method. The `addGlobalScope` method accepts an instance of your scope as its only argument:
- [!NOTE]
> There are additional events an observer can listen to, such as `saving` and `retrieved`. These events are described within the [events](#events) documentation.
diff --git a/queues.md b/queues.md
index b6dfffd8c1c..bacfe5277ca 100644
--- a/queues.md
+++ b/queues.md
@@ -232,28 +232,30 @@ If you would like to take total control over how the container injects dependenc
Because all loaded Eloquent model relationships also get serialized when a job is queued, the serialized job string can sometimes become quite large. Furthermore, when a job is deserialized and model relationships are re-retrieved from the database, they will be retrieved in their entirety. Any previous relationship constraints that were applied before the model was serialized during the job queueing process will not be applied when the job is deserialized. Therefore, if you wish to work with a subset of a given relationship, you should re-constrain that relationship within your queued job.
-Or, to prevent relations from being serialized, you can call the `withoutRelations` method on the model when setting a property value. This method will return an instance of the model without its loaded relationships:
+Or, to prevent relations from being serialized, you can call the `withoutRelations` method on the model when setting a property value. This method will return an instance of the model without its loaded relationships. If you are using PHP constructor property promotion and would like to indicate that an Eloquent model should not have its relations serialized, you may use the `WithoutRelations` attribute
- /**
- * Create a new job instance.
- */
- public function __construct(
- Podcast $podcast,
- ) {
- $this->podcast = $podcast->withoutRelations();
- }
-
-If you are using PHP constructor property promotion and would like to indicate that an Eloquent model should not have its relations serialized, you may use the `WithoutRelations` attribute:
+```php tab=Method
+/**
+ * Create a new job instance.
+ */
+public function __construct(
+ Podcast $podcast,
+) {
+ $this->podcast = $podcast->withoutRelations();
+}
+```
- use Illuminate\Queue\Attributes\WithoutRelations;
+```php tab=Attribute
+use Illuminate\Queue\Attributes\WithoutRelations;
- /**
- * Create a new job instance.
- */
- public function __construct(
- #[WithoutRelations]
- public Podcast $podcast,
- ) {}
+/**
+ * Create a new job instance.
+ */
+public function __construct(
+ #[WithoutRelations]
+ public Podcast $podcast,
+) {}
+```
If a job receives a collection or array of Eloquent models instead of a single model, the models within that collection will not have their relationships restored when the job is deserialized and executed. This is to prevent excessive resource usage on jobs that deal with large numbers of models.