How to Call a controller function in another Controller in Laravel 5

PHOTO EMBED

Fri Jun 04 2021 14:42:19 GMT+0000 (Coordinated Universal Time)

Saved by @mvieira #php

use App\Http\Controllers\OtherController;

class TestController extends Controller
{
    public function index()
    {
        //Calling a method that is from the OtherController
        $result = (new OtherController)->method();
    }
}

2) Second way

app('App\Http\Controllers\OtherController')->method();

Both way you can get another controller function.
content_copyCOPY

https://stackoverflow.com/questions/31948980/how-to-call-a-controller-function-in-another-controller-in-laravel-5/31949144