Monday, March 7, 2022

[FIXED] How to pass instance of Request from a controller function to another controller function

Issue

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);


Answered By - Sohel0415

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.