Sebastian Moncada Sebastian Moncada - 18 days ago 7
PHP Question

Laravel controladores

Buenas!,tengo varios controladores que tiene diferentes funciones, pero quiero llamar una funciĆ³n de un controlador A en un controlador B.
Pero no encuentro como realizarlo. Gracias!

Answer

From some Controller that isn't "FirstController" you'd call it like this,

app('App\Http\Controllers\FirstContoller')->somefunction();

You may want to create a trait for this though, here's a post that better explains a similar situation

Access Controller method from another controller in Laravel 5

Comments