Search code examples
phplaravellaravel-5laravel-5.3

How to pass instance of Request from a controller function to another controller function


I have to call a function from one controller an other controller.

public function getquickviews(Request $request){
     $report = new ReportController();
     $report ->Applications($request->except('cl_e_start_date'));//it's not working its giving me error that it expect and instance of Request and passed array()
}



    public function Applications(Request $request) 
    {
/*APP USAGE*/
     }

and I have to pass instance of Request to Application function. But the issue I don't wanted to pass all the parameter from getquickviews Request like if I am getting email,phone,name on the getquickviews function but I only have to pass phone,email to Application function.


Solution

  • Change this line

    $report ->Applications($request->except('cl_e_start_date'));
    

    To

    $report ->Applications($request);