From 574725e70f92648312b7bbe7fce53731c91a49e5 Mon Sep 17 00:00:00 2001 From: Martin Kiesel Date: Sat, 25 Nov 2017 21:53:28 +0100 Subject: [PATCH] Fix #49, update readme to include infromation about withCount sorting --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f5424e2..093f8e0 100755 --- a/README.md +++ b/README.md @@ -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: @@ -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. @@ -324,7 +324,6 @@ $sortableAs = ['nick_name']; ... ``` - In controller ```php @@ -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