File tree Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Original file line number Diff line number Diff line change 3
3
All notable changes to this project will be documented in this file. This project adheres to
4
4
[ Semantic Versioning] ( http://semver.org/ ) and [ this changelog format] ( http://keepachangelog.com/ ) .
5
5
6
+ ## Unreleased
7
+
8
+ ### Added
9
+
10
+ - The default JSON: API resource class can now be changed via
11
+ the ` LaravelJsonApi\Laravel\LaravelJsonApi::defaultResource() ` method. This should be set in a service
12
+ provider's ` register() ` method.
13
+ - [ #127 ] ( https://github.com/laravel-json-api/laravel/issues/127 ) The ` JsonApiResource ` class now has a
14
+ protected ` serializeRelation ` method that can be used to override the default serialization of relationships if
15
+ needed.
16
+
17
+ ### Fixed
18
+
19
+ - [ #130 ] ( https://github.com/laravel-json-api/laravel/issues/130 ) The ` JsonApiResource ` now correctly handles conditional
20
+ fields when iterating over relationships to find a specific relation.
21
+
6
22
## [ 1.0.1] - 2021-12-08
7
23
8
24
### Changed
@@ -13,8 +29,8 @@ All notable changes to this project will be documented in this file. This projec
13
29
### Fixed
14
30
15
31
- [ #139 ] ( https://github.com/laravel-json-api/laravel/issues/139 ) Fix the ` WhereHas ` and ` WhereDoesntHave ` filters.
16
- Previously these were not iterating over the filters from the correct resource schema - they were iterating over
17
- the filters from the schema to which the relationship belonged. They now correctly iterate over the filters from the
32
+ Previously these were not iterating over the filters from the correct resource schema - they were iterating over the
33
+ filters from the schema to which the relationship belonged. They now correctly iterate over the filters from the
18
34
schema for the resource that is on the inverse side of the relationship.
19
35
20
36
## [ 1.0.0] - 2021-07-31
Original file line number Diff line number Diff line change 25
25
"require" : {
26
26
"php" : " ^7.4|8.0.*" ,
27
27
"ext-json" : " *" ,
28
- "laravel-json-api/core" : " ^1.0.0 " ,
28
+ "laravel-json-api/core" : " ^1.1 " ,
29
29
"laravel-json-api/eloquent" : " ^1.0.1" ,
30
30
"laravel-json-api/encoder-neomerx" : " ^1.0.0" ,
31
31
"laravel-json-api/exceptions" : " ^1.0.0" ,
67
67
]
68
68
}
69
69
},
70
- "minimum-stability" : " stable " ,
70
+ "minimum-stability" : " dev " ,
71
71
"prefer-stable" : true ,
72
72
"config" : {
73
73
"sort-packages" : true
Original file line number Diff line number Diff line change 23
23
use InvalidArgumentException ;
24
24
use LaravelJsonApi \Core \Auth \AuthorizerResolver ;
25
25
use LaravelJsonApi \Core \Query \Custom \ExtendedQueryParameters ;
26
+ use LaravelJsonApi \Core \Resources \ResourceResolver ;
26
27
use LaravelJsonApi \Eloquent \Resources \Relation ;
27
28
use LaravelJsonApi \Laravel \Http \Requests \RequestResolver ;
28
29
@@ -58,6 +59,19 @@ public static function defaultAuthorizer(string $authorizerClass): self
58
59
return new self ();
59
60
}
60
61
62
+ /**
63
+ * Set the default resource class.
64
+ *
65
+ * @param string $resourceClass
66
+ * @return LaravelJsonApi
67
+ */
68
+ public static function defaultResource (string $ resourceClass ): self
69
+ {
70
+ ResourceResolver::useDefault ($ resourceClass );
71
+
72
+ return new self ();
73
+ }
74
+
61
75
/**
62
76
* Register a HTTP query class for the supplied resource type or types.
63
77
*
You can’t perform that action at this time.
0 commit comments