Let\'s say I have User
model with two methods:
User.php
class User extends Eloquent
{
/* Validation rules */
In stock Laravel, you can call update()
on a model, and it won't validate by default, which will give you the desired behavior you described. In the code you posted, you're explicitly overriding the update()
method to force validation.
There are two ways to make the "user" field optional in the code you posted:
Don't set "required" in your $rules for that field.
'user' => 'unique:users|alpha_num',
Don't override the update()
method to force validation before updating.