File tree Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 27
27
"ext-json" : " *" ,
28
28
"illuminate/database" : " ^10.0" ,
29
29
"illuminate/support" : " ^10.0" ,
30
- "laravel-json-api/core" : " ^3 .0"
30
+ "laravel-json-api/core" : " ^4 .0"
31
31
},
32
32
"require-dev" : {
33
33
"orchestra/testbench" : " ^8.0" ,
51
51
"dev-4.x" : " 4.x-dev"
52
52
}
53
53
},
54
- "minimum-stability" : " stable " ,
54
+ "minimum-stability" : " dev " ,
55
55
"prefer-stable" : true ,
56
56
"config" : {
57
57
"sort-packages" : true
Original file line number Diff line number Diff line change @@ -40,10 +40,12 @@ trait HasQueryParameters
40
40
/**
41
41
* @inheritDoc
42
42
*/
43
- public function withRequest (Request $ request ): BuilderContract
43
+ public function withRequest (? Request $ request ): BuilderContract
44
44
{
45
- $ this ->request = $ request ;
46
- $ this ->queryParameters = ExtendedQueryParameters::cast ($ request );
45
+ if ($ request ) {
46
+ $ this ->request = $ request ;
47
+ $ this ->queryParameters = ExtendedQueryParameters::cast ($ request );
48
+ }
47
49
48
50
return $ this ;
49
51
}
Original file line number Diff line number Diff line change 21
21
22
22
use Illuminate \Database \Eloquent \Model ;
23
23
use Illuminate \Support \Collection ;
24
+ use Illuminate \Support \ValidatedInput ;
24
25
use LaravelJsonApi \Contracts \Schema \Attribute ;
25
26
use LaravelJsonApi \Contracts \Schema \Field ;
26
27
use LaravelJsonApi \Contracts \Schema \Relation as RelationContract ;
@@ -87,9 +88,13 @@ public function __construct(
87
88
/**
88
89
* @inheritDoc
89
90
*/
90
- public function store (array $ validatedData ): object
91
+ public function store (ValidatedInput | array $ input ): object
91
92
{
92
- $ model = $ this ->hydrate ($ validatedData );
93
+ if ($ input instanceof ValidatedInput) {
94
+ $ input = $ input ->all ();
95
+ }
96
+
97
+ $ model = $ this ->hydrate ($ input );
93
98
94
99
/**
95
100
* Always refresh the model from the database.
You can’t perform that action at this time.
0 commit comments