Skip to main content
Laravel Bug Hunt Easy +10 XP

Mass Assignment

This creates a user but throws MassAssignmentException.

LaravelFind the bug
1User::create($request->all());
The bug is on line 1

Select the correct fix

Show answer and explanation

Answer: Add fields to $fillable on User model

Laravel protects against mass assignment. You must explicitly list allowed fields in $fillable on the model.

Hint: Laravel's mass assignment protection requires an explicit allow-list.

What this challenge tests

Bug Hunt in Laravel: security, eloquent.

Related challenges