Complete the code to retrieve all records from the User model.
$users = User::[1]();The all() method retrieves all records from the database table associated with the model.
Complete the code to find a User by its primary key.
$user = User::[1]($id);The find() method retrieves a record by its primary key.
Fix the error in the code to update a User's name and save it.
$user = User::find($id);
$user->name = [1];
$user->save();String values must be enclosed in quotes. Double quotes "John" or single quotes 'John' are valid.
Fill both blanks to create a new User and save it to the database.
$user = new User(); $user->[1] = 'alice@example.com'; $user->[2]();
Set the email attribute, then call save() to store the new user.
Fill all three blanks to delete a User by ID safely.
$user = User::[1]($id); if ($user) { $user->[2](); } else { [3]('User not found'); }
Use find() to get the user, delete() to remove it, and abort() to handle missing user gracefully.
