We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I use livewire, when updating an email I use
if ($this->email != $this->user->email) { $this->user->email_verified_at = null; $this->user->newEmail($this->user->email); }
if email_verified_at is not set to null, newEmail() will not create a new record in the pending_user_emails table
this is my edit file
class Edit extends Component { public User $user; public $roles = []; public $listsForFields = []; public $password = ''; public $password_confirmation = ''; public $email = ''; public function mount(User $user) { $this->user = $user; $this->email = $this->user->email; $this->roles = $this->user->roles()->pluck('id')->toArray(); $this->initListsForFields(); } public function render() { return view('livewire.user.edit'); } public function submit() { $this->validate(); $this->user->password = $this->password; if ($this->email != $this->user->email) { $this->user->email_verified_at = null; $this->user->newEmail($this->user->email); } else { $this->user->save(); } $this->user->roles()->sync($this->roles); return redirect()->route('users.index'); } protected function rules() { return [ 'user.name' => ['required', 'string', 'max:255'], 'user.email' => ['required', 'email', 'max:255', 'unique:users,email,' . $this->user->id], 'user.biography' => ['nullable'], 'roles' => ['required', 'array'], 'roles.*.id' => ['integer', 'exists:roles,id'], 'password' => ['string', 'min:8', 'confirmed'], 'password_confirmation' => ['string', 'min:8'], ]; } public function initListsForFields(): void { $this->listsForFields['roles'] = Role::pluck('name', 'id')->toArray(); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I use livewire, when updating an email I use
if email_verified_at is not set to null, newEmail() will not create a new record in the pending_user_emails table
this is my edit file
The text was updated successfully, but these errors were encountered: