Glossary

Mass assignment

Filling a database record from a whole form at once, which lets a user set fields the form never showed if you do not list the allowed ones.

In plain words

Imagine a bank form where you write your name and address, and the clerk copies every line you wrote straight into your account, including a line you added yourself: "balance: 1,000,000". Mass assignment is that clerk.

How to prevent it

List exactly which fields may be filled (in Laravel, #[Fillable(['title', 'body'])] on the model or the $fillable property) and save only data that passed validation, never $request->all(). Practise it in Secure a Laravel app.

Found this useful?

Every lesson stays free. Tap the thumbs up so we know what works, or say thanks with a soda or a coffee: it pays for hosting and new lessons.

Buy me a sodaBuy me a coffee

Want more on this?

Tell us which part was not clear, ask for a follow-up lesson, or request a lesson on any topic. We read every request.

I would like
Only to tell you when it is ready.

WhatsApp

Join the channelChat with us

Free lessons and updates in the channel. Questions about learning or training? Chat with us.