user3150060
user3150060

Reputation: 1745

Laravel error : email

I am getting a larval 4.2 error : email , I never seen this one before

my model : /User/Setting.php ( this is the line causing error)

 \User::find($user_id)->fill($update)->save();

Does anyone know what that error means?

Thanks

Upvotes: 0

Views: 50

Answers (1)

lukasgeiter
lukasgeiter

Reputation: 152860

This probably means that email is not in the $fillable array of your model. When you want to mass assign attributes to your model you have to whitelist the attributes that should be fillable. Just add this in your model and you should be good to go:

class User extends Eloquent {
    // [...]

    protected $fillable = ['foo', 'bar', 'email'];
}

(instead of foo and bar add the other attributes you want to pass to fill())

Upvotes: 1

Related Questions