I have two functions: - 1st function has route: ‘test’, and I’m sending some values with GET parameters. (test?key=value), and that’s ok.
But, now I want to call 1st function from 2nd function, and send some other values...
How to create 1st function to receive GET parameters within function variables “function ($key){...”
Example:
function my_first($values){
return $values['key'];
}
function my_second(){
$something['key'] = 'Value';
return 'Info from first: ' . $this->my_first($something['key']);
}
Then, I need to be able to call my_first() with 'test' route and send some parameters to $values variable.
I don’t know how to solve it. Thank you!
public function my_first($key = null)
{
return $key ?: request('key');
}
public function my_second()
{
$key = 'Value';
return 'Info from first: ' . $this->my_first($key);
}