@@ -38,23 +38,23 @@ public function getOptionsRoute():string
3838 array_pop ($ r );
3939 return implode ('/ ' , $ r ) . '/options ' ;
4040
41- if (!empty ($ this ->prefixSettings )) {
42- if (isset ($ this ->prefixSettings ['module ' ])) {
43- $ prefix = $ this ->prefixSettings ['module ' ];
44- return static ::finalOptionsRoute ($ prefix , $ this ->controllerId );
45- } elseif (isset ($ this ->prefixSettings ['namespace ' ]) && str_contains ($ this ->prefixSettings ['namespace ' ], '\modules \\' )) { # if `module` not present then check in namespace and then in path
46- $ prefix = static ::computeModule ('\\' , $ this ->prefixSettings ['namespace ' ]);
47- if ($ prefix ) {
48- return static ::finalOptionsRoute ($ prefix , $ this ->controllerId );
49- }
50- } elseif (isset ($ this ->prefixSettings ['path ' ]) && str_contains ($ this ->prefixSettings ['path ' ], '/modules/ ' )) {
51- $ prefix = static ::computeModule ('/ ' , $ this ->prefixSettings ['path ' ]);
52- if ($ prefix ) {
53- return static ::finalOptionsRoute ($ prefix , $ this ->controllerId );
54- }
55- }
56- }
57- return $ this ->controllerId .'/options ' ;
41+ // if (!empty($this->prefixSettings)) {
42+ // if (isset($this->prefixSettings['module'])) {
43+ // $prefix = $this->prefixSettings['module'];
44+ // return static::finalOptionsRoute($prefix, $this->controllerId);
45+ // } elseif (isset($this->prefixSettings['namespace']) && str_contains($this->prefixSettings['namespace'], '\modules\\')) { # if `module` not present then check in namespace and then in path
46+ // $prefix = static::computeModule('\\', $this->prefixSettings['namespace']);
47+ // if ($prefix) {
48+ // return static::finalOptionsRoute($prefix, $this->controllerId);
49+ // }
50+ // } elseif (isset($this->prefixSettings['path']) && str_contains($this->prefixSettings['path'], '/modules/')) {
51+ // $prefix = static::computeModule('/', $this->prefixSettings['path']);
52+ // if ($prefix) {
53+ // return static::finalOptionsRoute($prefix, $this->controllerId);
54+ // }
55+ // }
56+ // }
57+ // return $this->controllerId.'/options';
5858 }
5959
6060 /**
@@ -97,18 +97,18 @@ public function getRoute(): string
9797 if (isset ($ this ->prefixSettings ['module ' ])) {
9898 $ prefix = $ this ->prefixSettings ['module ' ];
9999// return static::finalOptionsRoute($prefix, $this->controllerId);
100- return trim ($ prefix , '/ ' ) . '/ ' . $ this ->controllerId . '/ ' . $ this ->id ;
100+ return trim ($ prefix , '/ ' ) . '/ ' . $ this ->controllerId . ( $ this -> id ? '/ ' . $ this ->id : '' ) ;
101101 } elseif (isset ($ this ->prefixSettings ['namespace ' ]) && str_contains ($ this ->prefixSettings ['namespace ' ], '\modules \\' )) { # if `module` not present then check in namespace and then in path
102102 $ prefix = static ::computeModule ('\\' , $ this ->prefixSettings ['namespace ' ]);
103103 if ($ prefix ) {
104104// return static::finalOptionsRoute($prefix, $this->controllerId);
105- return trim ($ prefix , '/ ' ) . '/ ' . $ this ->controllerId . '/ ' . $ this ->id ;
105+ return trim ($ prefix , '/ ' ) . '/ ' . $ this ->controllerId . ( $ this -> id ? '/ ' . $ this ->id : '' ) ;
106106 }
107107 } elseif (isset ($ this ->prefixSettings ['path ' ]) && str_contains ($ this ->prefixSettings ['path ' ], '/modules/ ' )) {
108108 $ prefix = static ::computeModule ('/ ' , $ this ->prefixSettings ['path ' ]);
109109 if ($ prefix ) {
110110// return static::finalOptionsRoute($prefix, $this->controllerId);
111- return trim ($ prefix , '/ ' ) . '/ ' . $ this ->controllerId . '/ ' . $ this ->id ;
111+ return trim ($ prefix , '/ ' ) . '/ ' . $ this ->controllerId . ( $ this -> id ? '/ ' . $ this ->id : '' ) ;
112112 }
113113 }
114114 }
@@ -118,6 +118,6 @@ public function getRoute(): string
118118// return trim($prefix, '/') . '/' . $this->controllerId . '/' . $this->id;
119119// }
120120
121- return $ this ->controllerId . '/ ' . $ this ->id ;
121+ return $ this ->controllerId . ( $ this -> id ? '/ ' . $ this ->id : '' ) ;
122122 }
123123}
0 commit comments