How to extend existing Controller #901
-
Hy, I want to add new function to the controller "Backend\Controllers\Users". How can i do this using a plugin. Thanks |
Beta Was this translation helpful? Give feedback.
Answered by
LukeTowers
May 15, 2023
Replies: 2 comments 1 reply
-
See https://wintercms.com/docs/services/behaviors#dynamically-creating-methods. \Backend\Controllers\Users::extend(function ($controller) {
$controller->addDynamicMethod('myMethod', function () use ($controller) {
// do stuff.
});
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
bennothommo
-
Thanks, I thought that 'addDynamicMethod' work only with models. I will test |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://wintercms.com/docs/services/behaviors#dynamically-creating-methods.