File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,7 @@ public function jsonSerialize()
222222 'title ' => $ this ->title (),
223223 'description ' => $ this ->description (),
224224 'column ' => $ this ->column (),
225+ 'key ' => static ::uriKey (),
225226 ], function (array $ initial ) {
226227 return $ this ->relatedRepositoryKey ? array_merge ($ initial , [
227228 'repository ' => $ this ->getRelatedRepository (),
@@ -231,7 +232,6 @@ public function jsonSerialize()
231232
232233 if ($ this ->isAdvanced ()) {
233234 $ serialized = array_merge ($ serialized , [
234- 'key ' => static ::uriKey (),
235235 'rules ' => $ this ->rules (app (Request::class)),
236236 'options ' => method_exists ($ this , 'options ' )
237237 ? collect ($ this ->options (app (Request::class)))->map (function ($ key , $ value ) {
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Binaryk \LaravelRestify \Tests \Unit ;
4+
5+ use Binaryk \LaravelRestify \Filters \MatchFilter ;
6+ use Binaryk \LaravelRestify \Tests \IntegrationTest ;
7+ use Illuminate \Testing \Fluent \AssertableJson ;
8+
9+ class MatchableFilterTest extends IntegrationTest
10+ {
11+ public function test_matchable_filter_has_key (): void
12+ {
13+ $ filter = new class extends MatchFilter {
14+
15+ };
16+
17+ tap (
18+ AssertableJson::fromArray ($ filter ->jsonSerialize ()),
19+ function (AssertableJson $ json ) {
20+ $ json
21+ ->dd ()
22+ ->dump ()
23+ ->where ('type ' , 'multiselect ' )
24+ ->where ('advanced ' , true )
25+ ->where ('title ' , 'Status filter ' )
26+ ->where ('description ' , 'Short description ' )
27+ ->where ('column ' , 'status ' )
28+ ->where ('key ' , 'status-filter ' )
29+ ->where ('rules ' , [
30+ 'status ' => ['required ' ],
31+ ])
32+ ->where ('options ' , [[
33+ 'label ' => 'Draft ' ,
34+ 'property ' => 'draft ' ,
35+ ]])
36+ ;
37+ }
38+ );
39+ }
40+ }
You can’t perform that action at this time.
0 commit comments