@@ -140,7 +140,7 @@ public function register(string $resourceType, string $controller, array $option
140140 */
141141 protected function addResourceIndex (string $ resourceType , string $ controller , array $ options ): IlluminateRoute
142142 {
143- $ uri = $ this ->getResourceUri ($ resourceType, $ options );
143+ $ uri = $ this ->getResourceUri ($ resourceType );
144144 $ action = $ this ->getResourceAction ($ resourceType , $ controller , 'index ' , null , $ options );
145145
146146 $ route = $ this ->router ->get ($ uri , $ action );
@@ -159,7 +159,7 @@ protected function addResourceIndex(string $resourceType, string $controller, ar
159159 */
160160 protected function addResourceStore (string $ resourceType , string $ controller , array $ options ): IlluminateRoute
161161 {
162- $ uri = $ this ->getResourceUri ($ resourceType, $ options );
162+ $ uri = $ this ->getResourceUri ($ resourceType );
163163 $ action = $ this ->getResourceAction ($ resourceType , $ controller , 'store ' , null , $ options );
164164
165165 $ route = $ this ->router ->post ($ uri , $ action );
@@ -179,7 +179,7 @@ protected function addResourceStore(string $resourceType, string $controller, ar
179179 protected function addResourceShow (string $ resourceType , string $ controller , array $ options ): IlluminateRoute
180180 {
181181 $ parameter = $ this ->getResourceParameterName ($ resourceType , $ options );
182- $ uri = $ this ->getResourceUri ($ resourceType, $ options );
182+ $ uri = $ this ->getResourceUri ($ resourceType );
183183 $ action = $ this ->getResourceAction ($ resourceType , $ controller , 'show ' , $ parameter , $ options );
184184
185185 $ route = $ this ->router ->get (sprintf ('%s/{%s} ' , $ uri , $ parameter ), $ action );
@@ -200,7 +200,7 @@ protected function addResourceShow(string $resourceType, string $controller, arr
200200 protected function addResourceUpdate (string $ resourceType , string $ controller , array $ options ): IlluminateRoute
201201 {
202202 $ parameter = $ this ->getResourceParameterName ($ resourceType , $ options );
203- $ uri = $ this ->getResourceUri ($ resourceType, $ options );
203+ $ uri = $ this ->getResourceUri ($ resourceType );
204204 $ action = $ this ->getResourceAction ($ resourceType , $ controller , 'update ' , $ parameter , $ options );
205205
206206 $ route = $ this ->router ->patch (sprintf ('%s/{%s} ' , $ uri , $ parameter ), $ action );
@@ -221,7 +221,7 @@ protected function addResourceUpdate(string $resourceType, string $controller, a
221221 protected function addResourceDestroy (string $ resourceType , string $ controller , array $ options ): IlluminateRoute
222222 {
223223 $ parameter = $ this ->getResourceParameterName ($ resourceType , $ options );
224- $ uri = $ this ->getResourceUri ($ resourceType, $ options );
224+ $ uri = $ this ->getResourceUri ($ resourceType );
225225 $ action = $ this ->getResourceAction ($ resourceType , $ controller , 'destroy ' , $ parameter , $ options );
226226
227227 $ route = $ this ->router ->delete (sprintf ('%s/{%s} ' , $ uri , $ parameter ), $ action );
@@ -233,16 +233,14 @@ protected function addResourceDestroy(string $resourceType, string $controller,
233233
234234 /**
235235 * @param string $resourceType
236- * @param array $options
237236 * @return string
238237 */
239- private function getResourceUri (string $ resourceType, array $ options ): string
238+ private function getResourceUri (string $ resourceType ): string
240239 {
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 ();
246244 }
247245
248246 /**
@@ -313,7 +311,7 @@ private function getResourceAction(
313311 */
314312 private function getRelationshipsAction (string $ resourceType , ?string $ parameter , array $ options )
315313 {
316- $ uri = $ this ->getResourceUri ($ resourceType, $ options );
314+ $ uri = $ this ->getResourceUri ($ resourceType );
317315
318316 $ action = [
319317 'prefix ' => sprintf ('%s/{%s} ' , $ uri , $ parameter ),
0 commit comments