Can I load the config file when the scheduling job starts?
I tried to use a local variable customerName
in Schedule Class and it already defined in the Config folder as named customerInfo
.
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use Config;
class Checkout extends Command
{
***
public function handle()
{
***
$customerName = Config::get('customerInfo.customer_name'); //test code
\Log::info($customerName); // for error check in log file
***
}
}
but it was not worked.
Do I have to declare it in the constructor
or have to use '\'
as '\Config'
even if already declared alias as use Config;
?
What is the best simple solution to use custom variable in Config when schedule job is running start?