Complete the code to connect to the default database in Laravel.
DB::[1]('select * from users');
The select method runs a query to get data from the database.
Complete the code to create a new user record using Eloquent.
$user = new User(); $user->name = 'John'; $user->email = 'john@example.com'; $user->[1]();
The save method stores the new user record in the database.
Fix the error in the query builder to get users older than 18.
$users = DB::table('users')->where('age', '[1]', 18)->get();
The operator '>' selects users older than 18.
Fill both blanks to update the email of a user with id 5.
DB::table('users')->where('id', [1])->[2](['email' => 'new@example.com']);
We specify the user id as 5 and use update to change the email.
Fill all three blanks to create a dictionary of user names and emails for users older than 20.
$users = DB::table('users')->where('age', '[1]', 20)->pluck('[2]', '[3]');
The operator '>' filters users older than 20, pluck gets emails as values and names as keys.
