Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Feb 19, 2021
1 parent a7484b5 commit 31b3f75
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions eloquent.md
Original file line number Diff line number Diff line change
Expand Up @@ -1062,18 +1062,15 @@ Once the expected arguments have been added to your scope method's signature, yo
<a name="comparing-models"></a>
## Comparing Models

Sometimes you may need to determine if two models are the "same" or "not same". The `is` method may be used to quickly verify two models have the same primary key, table, and database connection:
Sometimes you may need to determine if two models are the "same" or not. The `is` and `isNot` methods may be used to quickly verify two models have the same primary key, table, and database connection or not:

if ($post->is($anotherPost)) {
//
}

The `isNot` method used to determine if two models are "not same":

if ($post->isNot($anotherPost)) {
//
}


The `is` and `isNot` methods are also available when using the `belongsTo`, `hasOne`, `morphTo`, and `morphOne` [relationships](/docs/{{version}}/eloquent-relationships). This method is particularly helpful when you would like to compare a related model without issuing a query to retrieve that model:

Expand Down

0 comments on commit 31b3f75

Please sign in to comment.