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
Copy file name to clipboardExpand all lines: docs/docs/3.0/actions/actions.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -236,3 +236,44 @@ public function handle(ActionRequest $request, Post $post): JsonResponse
236
236
//
237
237
}
238
238
```
239
+
240
+
## Standalone actions
241
+
242
+
Sometimes you don't need to have an action with models. Let's say for example the authenticated user wants to disable his account. For this we have `standalone` actions:
243
+
244
+
245
+
```php
246
+
// UserRepository
247
+
248
+
public function actions(RestifyRequest $request)
249
+
{
250
+
return [
251
+
DisableProfileAction::new()->standalone(),
252
+
];
253
+
}
254
+
```
255
+
256
+
Just mark it as standalone with `->standalone` or override the property directly into the action:
257
+
258
+
```php
259
+
class DisableProfileAction extends Action
260
+
{
261
+
public $standalone = true;
262
+
263
+
//...
264
+
}
265
+
```
266
+
267
+
268
+
## URI Key
269
+
270
+
Usually the URL for the action is make based on the action name. You can use your own URI key if you want:
0 commit comments