Looks like you need to re-architect your code a bit. As a rule you should try to avoid constants in your code wherever possible; I have never had a need to use them in any code I have written. There is usually little need for them and they are sign of badly designed code IMO. This said, it seems that you have followed the instructions in the Authorize.net PHP SDK?
https://github.com/AuthorizeNet/sdk-php
In which case, it is understandable that you are hitting this problem, and it is annoying that their PHP library has been written to use constants. Unfortunately you will need to continue to use the constants, unless you wish to fork and change their library (which you really don't!).
To fix this issue, and follow good Laravel design practice, resolve the data you need from config files: Make a file in ./config directory, named something like authorize-net.php, then include the following:
<?php
return [
'authorizenet_api_login_id' => env('AUTHORIZENET_API_LOGIN_ID'),
'authorizenet_transaction_key' => env('AUTHORIZENET_TRANSACTION_KEY'),
'authorizenet_sandbox' => env('AUTHORIZENET_SANDBOX')
];
Then you can add the 3 environment variables in you .env file like:
AUTHORIZENET_API_LOGIN_ID=your-login-id
AUTHORIZENET_TRANSACTION_KEY=your-transaction-key
AUTHORIZENET_SANDBOX=true
Obviously true for the sandbox in your dev / testing / staging environments, and false for production.
Thereafter, in you code where you set the constants, use the following:
if(!defined('AUTHORIZENET_API_LOGIN_ID')){
define('AUTHORIZENET_API_LOGIN_ID', config('authorize-net')['authorizenet_api_login_id']);
}
if(!defined('AUTHORIZENET_TRANSACTION_KEY')){
define('AUTHORIZENET_TRANSACTION_KEY', config('authorize-net')['authorizenet_transaction_key']);
}
if(!defined('AUTHORIZENET_SANDBOX')){
define('AUTHORIZENET_SANDBOX', config('authorize-net')['authorizenet_sandbox']);
}
This then ensures that you separate your environment configuration nicely from the code (i.e. you don't hard code it and couple your code to your config).
I have not tested the above, as I do not use Authorize.net, but it should work, or put you on the right path; hopefully there are no syntax errors!
Good luck!