php - How to pass the data one function to another function in laravel?
I have two functions in one controller called changeData and apply
.the changeData have one object that should be used in the other function ..
public function changeData (){
$rq=Request();
$this->request=$rq->merge(["tax"=>$rq->tax *12]);
}
Public function apply (){
//Here I want to store $this->request in one variable called $data
}
Answer
Solution:
public function changeData () {
$rq = Request();
$this->request = $rq;
return $this;
}
public function apply (){
dd($this->request);
//Here I want to store $this->request in one variable called $data
}
Source