Skip to content

Allow registration of custom actions #36

Open
@tobyzerner

Description

@tobyzerner

For implementing behavior not defined by the spec.

Something like:

$type->resourceAction('publish', function ($model, Context $context) {
    $model->publish();
    return $model;
})
    ->authorized(...);

$type->collectionAction('purge', function (Context $context) {
    Post::delete();
    return new Response(204);
})
    ->method('delete')
    ->authorized(...);

Call via:

POST /api/posts/1/actions/publish
DELETE /api/posts/actions/purge

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions