Skip to content

Question | Is it possible to use custom controllers for actions? #232

@jesseyvanofferen

Description

@jesseyvanofferen

I was wondering if it's possible to use a custom / different controller for actions, for example I have the following route defined:

        $server->resource('users', JsonApiController::class)->actions(function ($actions) {
            $actions->get('me');
        });

In this case it's an example and I could easily change the users resource to use a UserController and include all traits, but the question is more about if it would be possible to define a different controller for an action than the resource. Perhaps having something like the UserController for the users resource and having something like a UserActionController for all the actions.

I could not find anything in the documentation about the flexibility in setting different controllers and was wondering if it's possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions