File tree Expand file tree Collapse file tree 7 files changed +7
-8
lines changed Expand file tree Collapse f
8000
ile tree 7 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 34
34
"laravel/framework" : " ^8.30"
35
35
},
36
36
"require-dev" : {
37
- "laravel-json-api/hashids" : " ^1.0.0-beta.2 " ,
37
+ "laravel-json-api/hashids" : " ^1.0.0-beta.3 " ,
38
38
"laravel-json-api/testing" : " ^1.0.0-beta.1" ,
39
39
"orchestra/testbench" : " ^6.9" ,
40
40
"phpunit/phpunit" : " ^9.5"
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ class CommentSchema extends Schema
44
44
public function fields (): array
45
45
{
46
46
return [
47
- HashId::make ()->alreadyHashed (),
47
+ HashId::make ()->alreadyHashed ()-> withLength ( 10 ) ,
48
48
Str::make ('content ' ),
49
49
DateTime::make ('createdAt ' )->sortable ()->readOnly (),
50
50
BelongsTo::make ('post ' ),
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ class PostSchema extends Schema
67
67
public function fields (): array
68
68
{
69
69
return [
70
- HashId::make ()->alreadyHashed (),
70
+ HashId::make ()->alreadyHashed ()-> withLength ( 10 ) ,
71
71
BelongsTo::make ('author ' )->type ('users ' )->readOnly (),
72
72
HasMany::make ('comments ' )->readOnly (),
73
73
Str::make ('content ' ),
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ class TagSchema extends Schema
44
44
public function fields (): array
45
45
{
46
46
return [
47
- HashId::make ()->alreadyHashed (),
47
+ HashId::make ()->alreadyHashed ()-> withLength ( 10 ) ,
48
48
DateTime::make ('createdAt ' )->sortable ()->readOnly (),
49
49
Str::make ('name ' )->sortable (),
50
50
BelongsToMany::make ('posts ' )
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ class UserSchema extends Schema
44
44
public function fields (): array
45
45
{
46
46
return [
47
- HashId::make ()->alreadyHashed (),
47
+ HashId::make ()->alreadyHashed ()-> withLength ( 10 ) ,
48
48
DateTime::make ('createdAt ' )->readOnly (),
49
49
Str::make ('name ' ),
50
50
DateTime::make ('updatedAt ' )->readOnly (),
Original file line number Diff line number Diff line change 19
19
20
20
/** Users */
21
21
$ server ->resource ('users ' )->only ('show ' )->actions (function ($ actions ) {
22
- // we use `-me` because `me` would match the hash-id pattern
23
- $ actions ->get ('-me ' , 'me ' );
22
+ $ actions ->get ('me ' );
24
23
});
25
24
26
25
/** Videos */
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public function testMe(): void
52
52
$ response = $ this
53
53
->actingAs ($ user )
54
54
->jsonApi ('users ' )
55
- ->get (url ('/api/v1/users/- me ' ));
55
+ ->get (url ('/api/v1/users/me ' ));
56
56
57
57
$ response ->assertFetchedOneExact ($ expected );
58
58
}
You can’t perform that action at this time.
0 commit comments