@@ -140,7 +140,7 @@ public function register(string $resourceType, string $controller, array $option
140
140
*/
141
141
protected function addResourceIndex (string $ resourceType , string $ controller , array $ options ): IlluminateRoute
142
142
{
143
- $ uri = $ this ->getResourceUri ($ resourceType, $ options );
143
+ $ uri = $ this ->getResourceUri ($ resourceType );
144
144
$ action = $ this ->getResourceAction ($ resourceType , $ controller , 'index ' , null , $ options );
145
145
146
146
$ route = $ this ->router ->get ($ uri , $ action );
@@ -159,7 +159,7 @@ protected function addResourceIndex(string $resourceType, string $controller, ar
159
159
*/
160
160
protected function addResourceStore (string $ resourceType , string $ controller , array $ options ): IlluminateRoute
161
161
{
162
- $ uri = $ this ->getResourceUri ($ resourceType, $ options );
162
+ $ uri = $ this ->getResourceUri ($ resourceType );
163
163
$ action = $ this ->getResourceAction ($ resourceType , $ controller , 'store ' , null , $ options );
164
164
165
165
$ route = $ this ->router ->post ($ uri , $ action );
@@ -179,7 +179,7 @@ protected function addResourceStore(string $resourceType, string $controller, ar
179
179
protected function addResourceShow (string $ resourceType , string $ controller , array $ options ): IlluminateRoute
180
180
{
181
181
$ parameter = $ this ->getResourceParameterName ($ resourceType , $ options );
182
- $ uri = $ this ->getResourceUri ($ resourceType, $ options );
182
+ $ uri = $ this ->getResourceUri ($ resourceType );
183
183
$ action = $ this ->getResourceAction ($ resourceType , $ controller , 'show ' , $ parameter , $ options );
184
184
185
185
$ route = $ this ->router ->get (sprintf ('%s/{%s} ' , $ uri , $ parameter ), $ action );
@@ -200,7 +200,7 @@ protected function addResourceShow(string $resourceType, string $controller, arr
200
200
protected function addResourceUpdate (string $ resourceType , string $ controller , array $ options ): IlluminateRoute
201
201
{
202
202
$ parameter = $ this ->getResourceParameterName ($ resourceType , $ options );
203
- $ uri = $ this ->getResourceUri ($ resourceType, $ options );
203
+ $ uri = $ this ->getResourceUri ($ resourceType );
204
204
$ action = $ this ->getResourceAction ($ resourceType , $ controller , 'update ' , $ parameter , $ options );
205
205
206
206
$ route = $ this ->router ->patch (sprintf ('%s/{%s} ' , $ uri , $ parameter ), $ action );
@@ -221,7 +221,7 @@ protected function addResourceUpdate(string $resourceType, string $controller, a
221
221
protected function addResourceDestroy (string $ resourceType , string $ controller , array $ options ): IlluminateRoute
222
222
{
223
223
$ parameter = $ this ->getResourceParameterName ($ resourceType , $ options );
224
- $ uri = $ this ->getResourceUri ($ resourceType, $ options );
224
+ $ uri = $ this ->getResourceUri ($ resourceType );
225
225
$ action = $ this ->getResourceAction ($ resourceType , $ controller , 'destroy ' , $ parameter , $ options );
226
226
227
227
$ route = $ this ->router ->delete (sprintf ('%s/{%s} ' , $ uri , $ parameter ), $ action );
@@ -233,16 +233,14 @@ protected function addResourceDestroy(string $resourceType, string $controller,
233
233
234
234
/**
235
235
* @param string $resourceType
236
- * @param array $options
237
236
* @return string
238
237
*/
239
- private function getResourceUri (string $ resourceType, array $ options ): string
238
+ private function getResourceUri (string $ resourceType ): string
240
239
{
241
- if (isset ($ options ['resource_uri ' ])) {
242
- return $ options ['resource_uri ' ];
243
- }
244
-
245
- return Str::dasherize ($ resourceType );
240
+ return $ this ->server
241
+ ->schemas ()
242
+ ->schemaFor ($ resourceType )
243
+ ->uriType ();
246
244
}
247
245
248
246
/**
@@ -313,7 +311,7 @@ private function getResourceAction(
313
311
*/
314
312
private function getRelationshipsAction (string $ resourceType , ?string $ parameter , array $ options )
315
313
{
316
- $ uri = $ this ->getResourceUri ($ resourceType, $ options );
314
+ $ uri = $ this ->getResourceUri ($ resourceType );
317
315
318
316
$ action = [
319
317
'prefix ' => sprintf ('%s/{%s} ' , $ uri , $ parameter ),
0 commit comments