Support the ongoing development of Laravel.io →
posted 3 years ago
Last updated 2 years ago.
0
moderator

Depending on your controller you could do something like:

$controller = new MyController();
$result = $controller->functionIWantToCall();

But to be honest if you want to call a function from another controller I suggest moving that function to another class. (Service/Helper/...) Most of the time you want your controller to contain only functions that are called from the request or internal functions that are only used in that controller.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.