Complete the code to access the app name from the configuration in Laravel.
$appName = config('[1]');
In Laravel, the config helper accesses configuration values. The app name is stored under app.name.
Complete the code to set a configuration value at runtime in Laravel.
config(['[1]' => 'smtp']);
To change the mail driver at runtime, set the mail.driver config key.
Fix the error in the code to correctly cache the configuration in Laravel.
php artisan config:[1]The correct command to cache configuration is php artisan config:cache.
Fill both blanks to create a config file array with database host and port.
<?php return [ 'host' => '[1]', 'port' => [2], ];
Typical MySQL database config uses host '127.0.0.1' and port 3306.
Fill all three blanks to retrieve a nested config value safely with a default fallback.
$timezone = config('[1]', [2]); // default // Using the value if ($timezone === [3]) { echo 'Default timezone used'; }
We get the timezone from 'app.timezone' config key, defaulting to 'UTC'. Then we check if the value equals 'UTC'.