how can i declare a global variable and initialize it? .
I have this situation, i am using NEXMO SMS APP in laravel and I have a global variable and I initialize it in my constructor, then i use the global variable in my public functions. After using it in my public functions, it says undefined variable. Why? . Please bare to help me, i am just a beginner.
Here is my code:
class CheckVerify extends Controller {
private $client;
public function __construct() {
$client = app('Nexmo\Client');
}
public function mobile_verification($number) {
$verification = $client->verify()->start([
'number' => $number,
'brand' => 'Mysite'
]);
}
public function check_verify($code) {
$client->verify()->check($verification, $code);
}
}