You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> You could skip this route setting if you just use `index` method of the controller.
135
+
> You don't need set routes if you just use `index` method of the controller.
116
136
117
137
---
118
138
@@ -131,11 +151,11 @@ The base RESTful API controller is `yidas\rest\Controller`, the following table
131
151
|DELETE |/photos |delete |Delete the entire collection. |
132
152
133
153
134
-
### Overrided Methods:
154
+
### Build Methods:
135
155
136
156
You could make a resource controller by referring the [Template of Resource Controller](https://github.com/yidas/codeigniter-rest/blob/dev/examples/RestController.php).
137
157
138
-
The following methods with arguments could be overrided when you need to defind response and open it:
158
+
The following methods with arguments could be add when you need to defind response and open it:
139
159
140
160
```php
141
161
public function index() {}
@@ -149,6 +169,39 @@ protected function delete($resourceID=null) {}
149
169
>
150
170
> `$resourceID` is the addressed identity of the resource from request
151
171
172
+
### Custom Routes & Methods
173
+
174
+
The default routing methods are below setting:
175
+
176
+
```php
177
+
protected $routes = [
178
+
'index' => 'index',
179
+
'store' => 'store',
180
+
'show' => 'show',
181
+
'update' => 'update',
182
+
'delete' => 'delete',
183
+
];
184
+
```
185
+
186
+
You could override to defind your own routing while creating a resource controller:
187
+
188
+
```php
189
+
class ApiController extends yidas\rest\Controller {
190
+
191
+
protected $routes = [
192
+
'index' => '_list',
193
+
'store' => 'save',
194
+
'show' => 'display',
195
+
'update' => 'edit',
196
+
'delete' => 'destory',
197
+
];
198
+
}
199
+
```
200
+
201
+
> The keys are refered to Action of Resource Controller table.
202
+
>
203
+
> For example: REST list `index` action will run `_list` method.
0 commit comments