Skip to content

Commit 0683e2b

Browse files
authored
update description of custom pivot model capabilities (#7895)
custom pivot models can do more than just define methods, such as cast attributes. we'll also make the wording a little more open ended so the reader doesn't think the capabilities are limited.
1 parent 773abc7 commit 0683e2b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

eloquent-relationships.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ You can also filter the results returned by `belongsToMany` relationship queries
663663
<a name="defining-custom-intermediate-table-models"></a>
664664
### Defining Custom Intermediate Table Models
665665

666-
If you would like to define a custom model to represent the intermediate table of your many-to-many relationship, you may call the `using` method when defining the relationship. Custom pivot models give you the opportunity to define additional methods on the pivot model.
666+
If you would like to define a custom model to represent the intermediate table of your many-to-many relationship, you may call the `using` method when defining the relationship. Custom pivot models give you the opportunity to define additional behavior on the pivot model, such as methods and casts.
667667

668668
Custom many-to-many pivot models should extend the `Illuminate\Database\Eloquent\Relations\Pivot` class while custom polymorphic many-to-many pivot models should extend the `Illuminate\Database\Eloquent\Relations\MorphPivot` class. For example, we may define a `Role` model which uses a custom `RoleUser` pivot model:
669669

0 commit comments

Comments
 (0)