0
0
Laravelframework~10 mins

Database configuration in Laravel - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the default database connection in Laravel's config file.

Laravel
'default' => '[1]',
Drag options to blanks, or click blank then click option'
Asqlite
Bpgsql
Csqlsrv
Dmysql
Attempts:
3 left
💡 Hint
Common Mistakes
Using a connection name that is not defined in the connections array.
Leaving the default connection empty.
2fill in blank
medium

Complete the code to specify the database host in Laravel's MySQL connection configuration.

Laravel
'host' => [1],
Drag options to blanks, or click blank then click option'
A'192.168.1.1'
B'localhost'
C'127.0.0.1'
D'mysql-server'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'localhost' which sometimes resolves differently.
Using an incorrect IP address.
3fill in blank
hard

Fix the error in the database username configuration line.

Laravel
'username' => env('[1]', 'root'),
Drag options to blanks, or click blank then click option'
ADB_USERNAME
BUSER_NAME
CDATABASE_USER
DDB_USER
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect environment variable names.
Forgetting to set the variable in the .env file.
4fill in blank
hard

Fill both blanks to configure the database port and charset in Laravel's MySQL connection.

Laravel
'port' => env('[1]', '3306'),
'charset' => '[2]',
Drag options to blanks, or click blank then click option'
ADB_PORT
Butf8mb4
Cutf8
DDATABASE_PORT
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'utf8' instead of 'utf8mb4' which lacks full Unicode support.
Using wrong environment variable names for port.
5fill in blank
hard

Fill all three blanks to complete the Laravel database connection array keys for strict mode, engine, and prefix.

Laravel
'strict' => [1],
'engine' => [2],
'prefix' => '[3]',
Drag options to blanks, or click blank then click option'
Atrue
Bfalse
Cnull
D""
Attempts:
3 left
💡 Hint
Common Mistakes
Setting strict mode to false when strict SQL is desired.
Using a string 'null' instead of null for engine.
Forgetting to quote the prefix string.