Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarpsvo committed Feb 19, 2020
1 parent a9d5d7a commit 39250bb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ php artisan vendor:publish --provider="OptimistDigital\NovaSortable\ToolServiceP
You can add your translations to `resources/lang/vendor/nova-sortable/` by creating a new translations file with the locale name (ie `et.json`) and copying the JSON from the existing `en.json`.
## Using on pivot table(s)
## Sorting BelongsToMany relatioship (w/ pivot table)
NB! Sorting is impossible when your pivot table has multiple items with the same ID pairs.
Expand All @@ -102,7 +102,7 @@ public $sortable = [
];
```
Then, add sorting to the pivot query manually. On the parent model (on which the pivot's are displayed), add `orderBy()` to the pivot query definition like so:
Finally, add sorting to the pivot query manually. On the parent model (on which the pivots are displayed), add `orderBy()` to the pivot query definition like so:
```
public function products()
Expand All @@ -114,8 +114,6 @@ public function products()
}
```
Now you should be able to sort the pivot models.
## Credits
- [Tarvo Reinpalu](https://github.com/Tarpsvo)
Expand Down

0 comments on commit 39250bb

Please sign in to comment.