Config() Function is not working here’s my code:
in Controller :
$keys = Integration::where('name', '=', 'parasut')->first()->keys;
$keys = (object)json_decode($keys);
$clientID = $keys->client_id;
$clientSecret = $keys->client_secret;
$email = $keys->email;
$password = $keys->password;
$redirectUri = 'urn:ietf:wg:oauth:2.0:oob';
config(['plugins.parasut.integration.parasut.PARASUT_USERNAME'=>$email]);
config(['plugins.parasut.integration.parasut.PARASUT_PASSWORD'=>$password]);
config(['plugins.parasut.integration.parasut.PARASUT_REDIRECT_URI'=>$redirectUri]);
config(['plugins.parasut.integration.parasut.PARASUT_CLIENT_ID'=>$clientID]);
config(['plugins.parasut.integration.parasut.PARASUT_CLIENT_SECRET'=>$clientSecret]);`
And Config File (Plugins/Parasut/Config/integration.php)
return [
"parasut" => [
"PARASUT_USERNAME" => "",
"PARASUT_PASSWORD" => "",
"PARASUT_COMPANY_ID" => "",
"PARASUT_CLIENT_ID" => "",
"PARASUT_CLIENT_SECRET" => "",
"PARASUT_REDIRECT_URI" => "",
]
] ;
Use :
return [
'username' => config('plugins.parasut.integration.parasut.PARASUT_USERNAME'),
'password' => config('plugins.parasut.integration.parasut.PARASUT_PASSWORD'),
'company_id' => config('plugins.parasut.integration.parasut.PARASUT_COMPANY_ID'),
'client_id' => config('plugins.parasut.integration.parasut.PARASUT_CLIENT_ID'),
'client_secret' => config('plugins.parasut.integration.parasut.PARASUT_CLIENT_SECRET'),
'redirect_uri' => config('plugins.parasut.integration.parasut.PARASUT_REDIRECT_URI'),
'api_url' => config('plugins.parasut.integration.parasut.PARASUT_API_URL', 'https://api.parasut.com/v4/'),
];
I cleared all cache data.
But I’m getting a null value
What am I doing wrong?