Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rules for Ammend #132

Closed
58bits opened this issue Aug 21, 2013 · 3 comments
Closed

Update Rules for Ammend #132

58bits opened this issue Aug 21, 2013 · 3 comments

Comments

@58bits
Copy link

58bits commented Aug 21, 2013

Just a suggestion, but you might want to consider updating your $updateRules used during an amend (user update) to include an extra option that checks for a unique username and email address, with the exception of the current user id. This would allow a user to change their email address or username, as long as they are still unique. As the rules are at the moment, there is no 'unique' check, and unless special rules are passed to ammend, a user could change their username to be the same as another user (like admin).

$updateRules = array(
            'username'=> 'required|alpha_dash|unique:users,username,'. $this->id,
            'email' => 'required|email|unique:users,email,'. $this->id,
            'password' => 'between:4,11|confirmed',
            'password_confirmation' => 'between:4,11',
            );
@nightowl77
Copy link

We are working on this issue. We actually want to completely do away with $updateRules, so that Confide works the same way Eloquent works (eloquent has no concept of $updateRules, you just supply $rules and everything works). The idea is that Confide encapsulates and hides these complexities from the programmer, which would then cut down on the amount of code and documentation required.

Please see #124 for a discussion about this.

Right now I am waiting for a pull request to be accepted for Ardent here (laravel-ardent/ardent#86). Once that is accepted I want to work on this "encapsulates and hides these complexities" version of Confide.

@58bits
Copy link
Author

58bits commented Aug 23, 2013

Great - glad to hear you're working on this!

@58bits 58bits closed this as completed Aug 23, 2013
@andrew13
Copy link
Collaborator

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants