Laravel Rust Course challenges Question 1 / 4 StoreNote has no anyone, authenticated, or authorize. What fails? Every request input type must declare who may submit it. Without anyone, authenticated, or authorize, it does not compile.
Review the lesson Next question Question 2 / 4 StoreNote fills Note and only declares title and body. The client also sends user_id. What is stored? create!(Note { user: &user, ..form })A fill struct lists the only columns the request may write. ..form copies those fields, and a submitted user_id is ignored. Set the author yourself.
Review the lesson Next question Question 3 / 4 UpdateNote uses Sometimes for title. A JSON PATCH omits title and sends body. What should the update do? Sometimes::Missing means the request left the field out, and ..input skips it. Sometimes::Present runs the rules and writes the value.
Review the lesson Next question Question 4 / 4 Why is the login password a Password rather than a String? The authentication guide types the field as laravel::hash::Password. It redacts the plain text in logs and fails validation when a password is too long to hash. PasswordHash, the stored form, does not implement Serialize.
Review the lesson See my result Practice questions Enable JavaScript for scoring, or check the answers below.
StoreNote has no anyone, authenticated, or authorize. What fails? The code does not compile
Every request input type must declare who may submit it. Without anyone, authenticated, or authorize, it does not compile.
Accept a note only through a validated form StoreNote fills Note and only declares title and body. The client also sends user_id. What is stored? create!(Note { user: &user, ..form })The author you set in the handler. The extra field is ignored
A fill struct lists the only columns the request may write. ..form copies those fields, and a submitted user_id is ignored. Set the author yourself.
Accept a note only through a validated form UpdateNote uses Sometimes for title. A JSON PATCH omits title and sends body. What should the update do? Keep the current title and write the submitted body
Sometimes::Missing means the request left the field out, and ..input skips it. Sometimes::Present runs the rules and writes the value.
Let only the author change a note Why is the login password a Password rather than a String? So the plain-text password stays out of logs, and an over-long password fails on that field
The authentication guide types the field as laravel::hash::Password. It redacts the plain text in logs and fails validation when a password is too long to hash. PasswordHash, the stored form, does not implement Serialize.
Sign in with a Password field Each answer is worth 25 points. Replays keep your highest score.