File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed
tests/dummy/app/JsonApi/V1/Posts Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ All notable changes to this project will be documented in this file. This projec
7
7
8
8
### Added
9
9
10
+ - [ #14 ] ( https://github.com/laravel-json-api/laravel/issues/14 ) Additional sort parameters can now be added to Eloquent
11
+ schemas. Previously only sortable attributes were supported. These new classes are added to schemas in the
12
+ ` sortables() ` method.
13
+ - Eloquent schemas now support a default sort order via the ` $defaultSort ` property.
10
14
- [ #74 ] ( https://github.com/laravel-json-api/laravel/issues/74 ) Developers can now add default include paths to the query
11
15
request classes (e.g. ` PostQuery ` and ` PostCollectionQuery ` ) via the ` $defaultIncludePaths ` property. These include
12
16
paths are used if the client does not provide any include paths.
Original file line number Diff line number Diff line change 26
26
"php" : " ^7.4|^8.0" ,
27
27
"ext-json" : " *" ,
28
28
"laravel-json-api/core" : " ^1.0.0-beta.3" ,
29
- "laravel-json-api/eloquent" : " ^1.0.0-beta.3 " ,
29
+ "laravel-json-api/eloquent" : " ^1.0.0-beta.4 " ,
30
30
"laravel-json-api/encoder-neomerx" : " ^1.0.0-beta.1" ,
31
31
"laravel-json-api/exceptions" : " ^1.0.0-beta.2" ,
32
32
"laravel-json-api/spec" : " ^1.0.0-beta.1" ,
33
- "laravel-json-api/validation" : " ^1.0.0-beta.1 " ,
33
+ "laravel-json-api/validation" : " ^1.0.0-beta.2 " ,
34
34
"laravel/framework" : " ^8.0"
35
35
},
36
36
"require-dev" : {
Original file line number Diff line number Diff line change 34
34
use LaravelJsonApi \Eloquent \Pagination \PagePagination ;
35
35
use LaravelJsonApi \Eloquent \Schema ;
36
36
use LaravelJsonApi \Eloquent \SoftDeletes ;
37
+ use LaravelJsonApi \Eloquent \Sorting \SortCount ;
37
38
use LaravelJsonApi \HashIds \HashId ;
38
39
39
40
class PostSchema extends Schema
@@ -93,6 +94,16 @@ public function filters(): array
93
94
];
94
95
}
95
96
97
+ /**
98
+ * @inheritDoc
99
+ */
100
+ public function sortables (): iterable
101
+ {
102
+ return [
103
+ SortCount::make ($ this , 'comments ' ),
104
+ ];
105
+ }
106
+
96
107
/**
97
108
* @inheritDoc
98
109
*/
You can’t perform that action at this time.
0 commit comments