lundi 1 mai 2017

How would I call another function in the same controller and pass in inputs?

I want to be able to call another function within the same controller rather than making another api call. The issue I can't seem to work around is how to pass in input values. For illustration purposes here is some example code:

class TestController extends Controller{
    public function first(formRequest $request){
        return response()->json([Input::get('foo').'-'.Input::get('bar')]);
    }

   public function two(){
       if(Input::get('test')){
           $newInput = ['foo'=>1,'bar'=>2];
           return $this->first()//?? this is where I am not sure how to pass in input.
       }
       return response()->json(['success']);
   }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire