So, the question pretty much explains what i want. Here is the minimum code of what i am doing.
class AuthorizeController extends Controller
{
private $aNetEnvironment;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->aNetEnvironment = env('ANetEnvironment');
}
public function setEnvironment()
{
$controller = new AnetController\GetCustomerProfileController($request);
// $this->aNetEnvironment = SANDBOX
$response = $controller->executeWithApiResponse(
\net\authorize\api\constants\ANetEnvironment::$this->aNetEnvironment
);
}
}
Searching stackoverflow i got two options, have tried both with no luck.
Trying, {$this->aNetEnvironment}
gives
syntax error, unexpected ')', expecting '('
Trying, $$this->aNetEnvironment
gives
Object of class App\Http\Controllers\AuthorizeController could not be converted to string
Edit:
Trying, ${$this->aNetEnvironment}
gives
Access to undeclared static property: net\authorize\api\constants\ANetEnvironment::$SANDBOX
Is there any other option ?
env('ANetEnvironment');
? - Kenny Horna