wintercms / wintercms/wn-user-plugin

Redefinition of variable parameters

Open
#48 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Bug
Dominant language
PHP
Stars
13
Forks
20
Avg merge
50m
Merged PRs (30d)
1

Description

Hello! In my plugin I'm using this code, to redefinition of variable parameters. On OctoberCMS it's working

public function boot(){
\RainLab\User\Models\User::extend(function($model) {
$model->bindEvent('model.beforeValidate', function() use ($model) {
$model->rules['email'] = 'required|between:55,60|email|unique:users';
});
});
}

On Winter.User when I replace \RainLab\User\Models\User to \Winter\User\Models\User it doesn`t work. Why?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the plugin's boot() method and inspect the model.beforeValidate binding on Winter\User\Models\User, including the email rule assignment. Compare that extension point with the OctoberCMS example and verify the behavior against the Winter User model. Done means identifying why the replacement no longer works and documenting the applicable model-extension path.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.