简体   繁体   中英

Laravel dynamic config variable get

This is my config/filesystems.php file.

'default' => env('FILESYSTEM_DRIVER', 's3'),

'disks' => [
       's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
        ],
       'b2' => [
            'driver' => 's3',
            'key' => env('B2_KEY_ID'),
            'secret' => env('B2_APP_KEY'),
        ],
]

How can I get default filesystem 's key value? I think this is possible.

config("filesystems.disks.". config("filesystems.default"). ".key") ;

I believe there is any better way. Can anyone help me?

If you want to change config value you should call config helper function and pass the value you want to set as the second argument. You can check it in Laravel documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM