I have a variable.
$key_test = 123456789;
I want to be able to access this 1 variable anywhere in my app even in config files, models, controllers, and views.
I've tried adding it in my boot()
:
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\VSE, App\CURL;
use View;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$key_test = 123456789;
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
I've tried to access it in one of my config file. I kept getting null
.
<?php
dd($key_test); <---- null
return [ ... ];
How do I access that variable in my config file?
Did I do it right in my boot()
?