<p>In viewController you can simply access your method like this:</p>
<pre><code>public function actionDetails(){        
    $data = DefaultController::statistics();            
    return $data;
}
</code></pre>
<p>I hope this will help.</p>
<p>Thanks.</p>

CC BY-SA 4.0
2021-08-31T14:27:39.513Z
2021-08-31T14:27:39.513Z
ZealousWeb
<p>As I have a method name statistics() in my defaultController and I have to use the same method in viewController is there any way to do so?</p>

<craft3><plugin-development>
I am working on a plugin and I have to use a method of one controller in another controller's method?
# I am working on a plugin and I have to use a method of one controller in another controller's method?

(Asked by: username_0 on 2021-08-31)

As I have a method name statistics() in my defaultController and I have to use the same method in viewController is there any way to do so?

**Tags:** craft3, plugin-development

---

## 1 answers

### Answer by username_1 on 2021-08-31. Score: 1 | Accepted answer

In viewController you can simply access your method like this:
public function actionDetails(){        
    $data = DefaultController::statistics();            
    return $data;
}

I hope this will help.
Thanks.


---

