File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ All notable changes to this project will be documented in this file. This projec
11
11
actions were authorized via the single ` showRelationship() ` method. Adding the new ` showRelated ` method means
12
12
developers can now implement separate authorization logic for these two actions if desired. Our default implementation
13
13
remains unchanged - both are authorized using the ` view<RelationshipName> ` method on the relevant policy.
14
+ - The request class now has a ` isCreatingOrUpdating() ` helper method to determine whether the request is to create or
15
+ updated a resource.
14
16
15
17
## [ 1.0.0-beta.4] - 2021-06-02
16
18
Original file line number Diff line number Diff line change @@ -125,6 +125,16 @@ public function isUpdating(): bool
125
125
return $ this ->isMethod ('PATCH ' ) && $ this ->isNotRelationship ();
126
126
}
127
127
128
+ /**
129
+ * Is this a request to create or update a resource?
130
+ *
131
+ * @return bool
132
+ */
133
+ public function isCreatingOrUpdating (): bool
134
+ {
135
+ return $ this ->isCreating () || $ this ->isUpdating ();
136
+ }
137
+
128
138
/**
129
139
* Is this a request to replace a resource relationship?
130
140
*
Original file line number Diff line number Diff line change @@ -238,7 +238,7 @@ public function validatedForRelation()
238
238
*/
239
239
protected function prepareForValidation ()
240
240
{
241
- if ($ this ->isCreating () || $ this -> isUpdating ()) {
241
+ if ($ this ->isCreatingOrUpdating ()) {
242
242
$ this ->assertSupportedMediaType ();
243
243
$ this ->validateResourceDocument ();
244
244
} else if ($ this ->isModifyingRelationship ()) {
You can’t perform that action at this time.
0 commit comments