Call Laravel controller from code and pass HTTP headers to it
问题 To call a controller I use a CURL request like this: curl -kX POST https://site/method -H 'Authorization: Bearer ACCESS_TOKEN\ Content-Type:application/json' -d ' { "param1":"value 1", "param2":"value 2", "param3":"value 3" }' The route calls UserController@method. How can I do the same from Laravel code (internal request, not sending CURL)? I've found an advice to use something like this $controller = app()->make($controllerName); $response = app()->call([$controller, 'method'], []); echo