Skip to content

Commit

Permalink
Fix #49, update readme to include infromation about withCount sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyslik committed Nov 25, 2017
1 parent 4150879 commit 574725e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ In config file you can set your own separator in case `.` (dot) is not what you

# ColumnSortable overriding (advanced)

It is possible to override ColumnSortable relation feature, basically you can write your own join(s) / queries and apply `orderBy()` manualy.
It is possible to override ColumnSortable relation feature, basically you can write your own join(s) / queries and apply `orderBy()` manually.

See example:

Expand All @@ -312,7 +312,7 @@ In view just use `@sortablelink('address')`

>Huge thanks to @neutralrockets and his comments on [#8](https://github.com/Kyslik/column-sortable/issues/8). Another example on how to use overriding is issue [#41](https://github.com/Kyslik/column-sortable/issues/41#issuecomment-250895909).
# `$sortableAs` (aliasing)
# Aliasing

It is possible to declare `$sortableAs` array and use it to alias (bypass column exists check), and ignore prefixing with table.

Expand All @@ -324,7 +324,6 @@ $sortableAs = ['nick_name'];
...
```


In controller

```php
Expand All @@ -336,7 +335,11 @@ In view
@sortablelink('nick_name', 'nick')
```

Please see [#44](https://github.com/Kyslik/column-sortable/issues/44).
See [#44](https://github.com/Kyslik/column-sortable/issues/44) for more information on aliasing.

## Sort `withCount()`

Aliasing is useful when you want to sort results with [`withCount()`](https://laravel.com/docs/5.5/eloquent-relationships#counting-related-models), see [issue #49](https://github.com/Kyslik/column-sortable/issues/49) for more information.

# Exception to catch

Expand Down

0 comments on commit 574725e

Please sign in to comment.