After upgrading to latest version of Laravel, I get an error message when I try to log out after being logged in.
My validation looks like this (I've put this in the User model):
public $errors;
protected static $rules = array(
'name' => 'required',
'email' => 'required,email',
'company_id' => 'required,integer'
);
public static function boot()
{
parent::boot();
static::saved(function()
{
// Cache::forget('query.user.all');
});
static::saving(function($model)
{
return $model->validate();
});
}
public function validate()
{
$v = Validator::make($this->getAttributes(), static::$rules);
if ($v->fails())
{
$this->errors = $v->messages();
return FALSE;
}
return TRUE;
}
I think it's because the form input doesn't exist when logging out, so the validation fails. Is there a way to split the save function into one for logging in, and one for logging out?