Recall & Review
beginner
What is the purpose of config files in Laravel?
Config files store settings and options for your Laravel app, like database info or app name. They help keep code clean and easy to change.
Click to reveal answer
beginner
Where are Laravel config files stored?
All config files are in the
config/ folder at the root of your Laravel project.Click to reveal answer
beginner
How do you access a config value in Laravel code?
Use the
config() helper function with dot notation. For example, config('app.timezone') gets the timezone setting from config/app.php.Click to reveal answer
intermediate
What happens if you try to access a config key that does not exist?
Laravel returns
null by default. You can provide a default value as a second argument to config() to avoid nulls.Click to reveal answer
intermediate
Why should sensitive data like passwords be stored in environment files instead of config files?
Environment files (
.env) keep secrets out of code and config files. This helps keep sensitive info safe and makes it easy to change per environment.Click to reveal answer
Where do you find Laravel's config files?
✗ Incorrect
Laravel stores all configuration files inside the
config/ directory.How do you get the app name from config in Laravel?
✗ Incorrect
Use
config('app.name') to access the app name from the config/app.php file.What does Laravel return if a config key is missing and no default is given?
✗ Incorrect
Laravel returns
null if the config key does not exist and no default value is provided.Where should you store sensitive info like passwords in Laravel?
✗ Incorrect
Sensitive data should be stored in the
.env file to keep it secure and separate from code.How can you provide a default value when accessing a config key?
✗ Incorrect
You can pass a second argument to
config() as a default value if the key is missing.Explain how Laravel config files work and how you access their values in code.
Think about where settings live and how you read them.
You got /4 concepts.
Why is it important to keep sensitive data in environment files instead of config files in Laravel?
Consider safety and changing settings for different servers.
You got /4 concepts.